From 8643657fee2197719e014423ca1e6cbfee72268f Mon Sep 17 00:00:00 2001 From: Ravi Gulhane <> Date: Fri, 3 Jul 2026 16:55:57 +0530 Subject: [PATCH] 3july --- dist/assets/index-Cq3hylG7.js | 2600 ----------------- dist/assets/index.es-D7LZE7Yc.js | 18 - dist/index.html | 2 +- src/app/components/AppShell.tsx | 5 - src/app/components/MainContent.tsx | 8 +- src/app/components/NavBar.tsx | 3 +- src/app/components/agenda/AgendaPage.tsx | 16 +- .../analytics/EventAnalyticsPage.tsx | 4 - .../components/dashboard/EventHomeModules.tsx | 616 ++-- src/app/components/events/EventsPage.tsx | 2 +- src/app/components/search/searchIndex.tsx | 3 +- 11 files changed, 223 insertions(+), 3054 deletions(-) delete mode 100644 dist/assets/index-Cq3hylG7.js delete mode 100644 dist/assets/index.es-D7LZE7Yc.js diff --git a/dist/assets/index-Cq3hylG7.js b/dist/assets/index-Cq3hylG7.js deleted file mode 100644 index de5f3828..00000000 --- a/dist/assets/index-Cq3hylG7.js +++ /dev/null @@ -1,2600 +0,0 @@ -var _J=Object.defineProperty;var CJ=(e,t,r)=>t in e?_J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var yn=(e,t,r)=>CJ(e,typeof t!="symbol"?t+"":t,r);function EJ(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 L0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r5={exports:{}},my={},n5={exports:{}},qr={};/** - * @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 vO;function AJ(){if(vO)return qr;vO=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(D){return D===null||typeof D!="object"?null:(D=f&&D[f]||D["@@iterator"],typeof D=="function"?D:null)}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,m={};function b(D,z,q){this.props=D,this.context=z,this.refs=m,this.updater=q||p}b.prototype.isReactComponent={},b.prototype.setState=function(D,z){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,z,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function x(){}x.prototype=b.prototype;function w(D,z,q){this.props=D,this.context=z,this.refs=m,this.updater=q||p}var k=w.prototype=new x;k.constructor=w,v(k,b.prototype),k.isPureReactComponent=!0;var j=Array.isArray,_=Object.prototype.hasOwnProperty,T={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function P(D,z,q){var G,U={},Q=null,K=null;if(z!=null)for(G in z.ref!==void 0&&(K=z.ref),z.key!==void 0&&(Q=""+z.key),z)_.call(z,G)&&!A.hasOwnProperty(G)&&(U[G]=z[G]);var re=arguments.length-2;if(re===1)U.children=q;else if(1>>1,z=$[D];if(0>>1;Do(U,V))Qo(K,U)?($[D]=K,$[Q]=V,D=Q):($[D]=U,$[G]=V,D=G);else if(Qo(K,V))$[D]=K,$[Q]=V,D=Q;else break e}}return ee}function o($,ee){var V=$.sortIndex-ee.sortIndex;return V!==0?V:$.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,v=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,x=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($){for(var ee=r(u);ee!==null;){if(ee.callback===null)n(u);else if(ee.startTime<=$)n(u),ee.sortIndex=ee.expirationTime,t(c,ee);else break;ee=r(u)}}function j($){if(m=!1,k($),!v)if(r(c)!==null)v=!0,Y(_);else{var ee=r(u);ee!==null&&X(j,ee.startTime-$)}}function _($,ee){v=!1,m&&(m=!1,x(P),P=-1),p=!0;var V=h;try{for(k(ee),f=r(c);f!==null&&(!(f.expirationTime>ee)||$&&!C());){var D=f.callback;if(typeof D=="function"){f.callback=null,h=f.priorityLevel;var z=D(f.expirationTime<=ee);ee=e.unstable_now(),typeof z=="function"?f.callback=z:f===r(c)&&n(c),k(ee)}else n(c);f=r(c)}if(f!==null)var q=!0;else{var G=r(u);G!==null&&X(j,G.startTime-ee),q=!1}return q}finally{f=null,h=V,p=!1}}var T=!1,A=null,P=-1,N=5,O=-1;function C(){return!(e.unstable_now()-O$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var ee=3;break;default:ee=h}var V=h;h=ee;try{return $()}finally{h=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,ee){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=h;h=$;try{return ee()}finally{h=V}},e.unstable_scheduleCallback=function($,ee,V){var D=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0D?($.sortIndex=V,t(u,$),r(c)===null&&$===r(u)&&(m?(x(P),P=-1):m=!0,X(j,V-D))):($.sortIndex=z,t(c,$),v||p||(v=!0,Y(_))),$},e.unstable_shouldYield=C,e.unstable_wrapCallback=function($){var ee=h;return function(){var V=h;h=ee;try{return $.apply(this,arguments)}finally{h=V}}}})(a5)),a5}var SO;function OJ(){return SO||(SO=1,o5.exports=IJ()),o5.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 jO;function NJ(){if(jO)return os;jO=1;var e=Qw(),t=OJ();function r(g){for(var y="https://reactjs.org/docs/error-decoder.html?invariant="+g,E=1;E"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,y,E,B){if(E!==null&&E.type===0)return!1;switch(typeof y){case"function":case"symbol":return!0;case"boolean":return B?!1:E!==null?!E.acceptsBooleans:(g=g.toLowerCase().slice(0,5),g!=="data-"&&g!=="aria-");default:return!1}}function v(g,y,E,B){if(y===null||typeof y>"u"||p(g,y,E,B))return!0;if(B)return!1;if(E!==null)switch(E.type){case 3:return!y;case 4:return y===!1;case 5:return isNaN(y);case 6:return isNaN(y)||1>y}return!1}function m(g,y,E,B,J,ne,ge){this.acceptsBooleans=y===2||y===3||y===4,this.attributeName=B,this.attributeNamespace=J,this.mustUseProperty=E,this.propertyName=g,this.type=y,this.sanitizeURL=ne,this.removeEmptyString=ge}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(g){b[g]=new m(g,0,!1,g,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(g){var y=g[0];b[y]=new m(y,1,!1,g[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(g){b[g]=new m(g,2,!1,g.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(g){b[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){b[g]=new m(g,3,!1,g.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(g){b[g]=new m(g,3,!0,g,null,!1,!1)}),["capture","download"].forEach(function(g){b[g]=new m(g,4,!1,g,null,!1,!1)}),["cols","rows","size","span"].forEach(function(g){b[g]=new m(g,6,!1,g,null,!1,!1)}),["rowSpan","start"].forEach(function(g){b[g]=new m(g,5,!1,g.toLowerCase(),null,!1,!1)});var x=/[\-:]([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 y=g.replace(x,w);b[y]=new m(y,1,!1,g,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(g){var y=g.replace(x,w);b[y]=new m(y,1,!1,g,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(g){var y=g.replace(x,w);b[y]=new m(y,1,!1,g,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(g){b[g]=new m(g,1,!1,g.toLowerCase(),null,!1,!1)}),b.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(g){b[g]=new m(g,1,!1,g.toLowerCase(),null,!0,!0)});function k(g,y,E,B){var J=b.hasOwnProperty(y)?b[y]:null;(J!==null?J.type!==0:B||!(2Fe||J[ge]!==ne[Fe]){var Ke=` -`+J[ge].replace(" at new "," at ");return g.displayName&&Ke.includes("")&&(Ke=Ke.replace("",g.displayName)),Ke}while(1<=ge&&0<=Fe);break}}}finally{q=!1,Error.prepareStackTrace=E}return(g=g?g.displayName||g.name:"")?z(g):""}function U(g){switch(g.tag){case 5:return z(g.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return g=G(g.type,!1),g;case 11:return g=G(g.type.render,!1),g;case 1:return g=G(g.type,!0),g;default:return""}}function Q(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 A:return"Fragment";case T:return"Portal";case N:return"Profiler";case P:return"StrictMode";case R:return"Suspense";case F:return"SuspenseList"}if(typeof g=="object")switch(g.$$typeof){case C:return(g.displayName||"Context")+".Consumer";case O:return(g._context.displayName||"Context")+".Provider";case I:var y=g.render;return g=g.displayName,g||(g=y.displayName||y.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case M:return y=g.displayName||null,y!==null?y:Q(g.type)||"Memo";case Y:y=g._payload,g=g._init;try{return Q(g(y))}catch{}}return null}function K(g){var y=g.type;switch(g.tag){case 24:return"Cache";case 9:return(y.displayName||"Context")+".Consumer";case 10:return(y._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return g=y.render,g=g.displayName||g.name||"",y.displayName||(g!==""?"ForwardRef("+g+")":"ForwardRef");case 7:return"Fragment";case 5:return y;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(y);case 8:return y===P?"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 y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y}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 H(g){var y=g.type;return(g=g.nodeName)&&g.toLowerCase()==="input"&&(y==="checkbox"||y==="radio")}function ie(g){var y=H(g)?"checked":"value",E=Object.getOwnPropertyDescriptor(g.constructor.prototype,y),B=""+g[y];if(!g.hasOwnProperty(y)&&typeof E<"u"&&typeof E.get=="function"&&typeof E.set=="function"){var J=E.get,ne=E.set;return Object.defineProperty(g,y,{configurable:!0,get:function(){return J.call(this)},set:function(ge){B=""+ge,ne.call(this,ge)}}),Object.defineProperty(g,y,{enumerable:E.enumerable}),{getValue:function(){return B},setValue:function(ge){B=""+ge},stopTracking:function(){g._valueTracker=null,delete g[y]}}}}function de(g){g._valueTracker||(g._valueTracker=ie(g))}function le(g){if(!g)return!1;var y=g._valueTracker;if(!y)return!0;var E=y.getValue(),B="";return g&&(B=H(g)?g.checked?"true":"false":g.value),g=B,g!==E?(y.setValue(g),!0):!1}function ke(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 ve(g,y){var E=y.checked;return V({},y,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:E??g._wrapperState.initialChecked})}function se(g,y){var E=y.defaultValue==null?"":y.defaultValue,B=y.checked!=null?y.checked:y.defaultChecked;E=re(y.value!=null?y.value:E),g._wrapperState={initialChecked:B,initialValue:E,controlled:y.type==="checkbox"||y.type==="radio"?y.checked!=null:y.value!=null}}function be(g,y){y=y.checked,y!=null&&k(g,"checked",y,!1)}function De(g,y){be(g,y);var E=re(y.value),B=y.type;if(E!=null)B==="number"?(E===0&&g.value===""||g.value!=E)&&(g.value=""+E):g.value!==""+E&&(g.value=""+E);else if(B==="submit"||B==="reset"){g.removeAttribute("value");return}y.hasOwnProperty("value")?ue(g,y.type,E):y.hasOwnProperty("defaultValue")&&ue(g,y.type,re(y.defaultValue)),y.checked==null&&y.defaultChecked!=null&&(g.defaultChecked=!!y.defaultChecked)}function ae(g,y,E){if(y.hasOwnProperty("value")||y.hasOwnProperty("defaultValue")){var B=y.type;if(!(B!=="submit"&&B!=="reset"||y.value!==void 0&&y.value!==null))return;y=""+g._wrapperState.initialValue,E||y===g.value||(g.value=y),g.defaultValue=y}E=g.name,E!==""&&(g.name=""),g.defaultChecked=!!g._wrapperState.initialChecked,E!==""&&(g.name=E)}function ue(g,y,E){(y!=="number"||ke(g.ownerDocument)!==g)&&(E==null?g.defaultValue=""+g._wrapperState.initialValue:g.defaultValue!==""+E&&(g.defaultValue=""+E))}var Me=Array.isArray;function Se(g,y,E,B){if(g=g.options,y){y={};for(var J=0;J"+y.valueOf().toString()+"",y=xt.firstChild;g.firstChild;)g.removeChild(g.firstChild);for(;y.firstChild;)g.appendChild(y.firstChild)}});function Te(g,y){if(y){var E=g.firstChild;if(E&&E===g.lastChild&&E.nodeType===3){E.nodeValue=y;return}}g.textContent=y}var et={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},Pt=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(g){Pt.forEach(function(y){y=y+g.charAt(0).toUpperCase()+g.substring(1),et[y]=et[g]})});function qe(g,y,E){return y==null||typeof y=="boolean"||y===""?"":E||typeof y!="number"||y===0||et.hasOwnProperty(g)&&et[g]?(""+y).trim():y+"px"}function Et(g,y){g=g.style;for(var E in y)if(y.hasOwnProperty(E)){var B=E.indexOf("--")===0,J=qe(E,y[E],B);E==="float"&&(E="cssFloat"),B?g.setProperty(E,J):g[E]=J}}var vt=V({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 Ft(g,y){if(y){if(vt[g]&&(y.children!=null||y.dangerouslySetInnerHTML!=null))throw Error(r(137,g));if(y.dangerouslySetInnerHTML!=null){if(y.children!=null)throw Error(r(60));if(typeof y.dangerouslySetInnerHTML!="object"||!("__html"in y.dangerouslySetInnerHTML))throw Error(r(61))}if(y.style!=null&&typeof y.style!="object")throw Error(r(62))}}function Ce(g,y){if(g.indexOf("-")===-1)return typeof y.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 lt=null;function Xe(g){return g=g.target||g.srcElement||window,g.correspondingUseElement&&(g=g.correspondingUseElement),g.nodeType===3?g.parentNode:g}var Be=null,ct=null,Tt=null;function We(g){if(g=Jd(g)){if(typeof Be!="function")throw Error(r(280));var y=g.stateNode;y&&(y=wp(y),Be(g.stateNode,g.type,y))}}function ce(g){ct?Tt?Tt.push(g):Tt=[g]:ct=g}function he(){if(ct){var g=ct,y=Tt;if(Tt=ct=null,We(g),y)for(g=0;g>>=0,g===0?32:31-(rl(g)/Bv|0)|0}var mu=64,Ea=4194304;function nl(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 _c(g,y){var E=g.pendingLanes;if(E===0)return 0;var B=0,J=g.suspendedLanes,ne=g.pingedLanes,ge=E&268435455;if(ge!==0){var Fe=ge&~J;Fe!==0?B=nl(Fe):(ne&=ge,ne!==0&&(B=nl(ne)))}else ge=E&~J,ge!==0?B=nl(ge):ne!==0&&(B=nl(ne));if(B===0)return 0;if(y!==0&&y!==B&&(y&J)===0&&(J=B&-B,ne=y&-y,J>=ne||J===16&&(ne&4194240)!==0))return y;if((B&4)!==0&&(B|=E&16),y=g.entangledLanes,y!==0)for(g=g.entanglements,y&=B;0E;E++)y.push(g);return y}function vu(g,y,E){g.pendingLanes|=y,y!==536870912&&(g.suspendedLanes=0,g.pingedLanes=0),g=g.eventTimes,y=31-Gr(y),g[y]=E}function Wv(g,y){var E=g.pendingLanes&~y;g.pendingLanes=y,g.suspendedLanes=0,g.pingedLanes=0,g.expiredLanes&=y,g.mutableReadLanes&=y,g.entangledLanes&=y,y=g.entanglements;var B=g.eventTimes;for(g=g.expirationTimes;0=zi),dp=" ",Ta=!1;function Pc(g,y){switch(g){case"keyup":return up.indexOf(y.keyCode)!==-1;case"keydown":return y.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ud(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var Es=!1;function Pu(g,y){switch(g){case"compositionend":return Ud(y);case"keypress":return y.which!==32?null:(Ta=!0,dp);case"textInput":return g=y.data,g===dp&&Ta?null:g;default:return null}}function fp(g,y){if(Es)return g==="compositionend"||!Ka&&Pc(g,y)?(g=Su(),Tc=Ac=Ya=null,Es=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(y.ctrlKey||y.altKey||y.metaKey)||y.ctrlKey&&y.altKey){if(y.char&&1=y)return{node:E,offset:y-g};g=B}e:{for(;E;){if(E.nextSibling){E=E.nextSibling;break e}E=E.parentNode}E=void 0}E=oo(E)}}function _n(g,y){return g&&y?g===y?!0:g&&g.nodeType===3?!1:y&&y.nodeType===3?_n(g,y.parentNode):"contains"in g?g.contains(y):g.compareDocumentPosition?!!(g.compareDocumentPosition(y)&16):!1:!1}function Cn(){for(var g=window,y=ke();y instanceof g.HTMLIFrameElement;){try{var E=typeof y.contentWindow.location.href=="string"}catch{E=!1}if(E)g=y.contentWindow;else break;y=ke(g.document)}return y}function ri(g){var y=g&&g.nodeName&&g.nodeName.toLowerCase();return y&&(y==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||y==="textarea"||g.contentEditable==="true")}function Mi(g){var y=Cn(),E=g.focusedElem,B=g.selectionRange;if(y!==E&&E&&E.ownerDocument&&_n(E.ownerDocument.documentElement,E)){if(B!==null&&ri(E)){if(y=B.start,g=B.end,g===void 0&&(g=y),"selectionStart"in E)E.selectionStart=y,E.selectionEnd=Math.min(g,E.value.length);else if(g=(y=E.ownerDocument||document)&&y.defaultView||window,g.getSelection){g=g.getSelection();var J=E.textContent.length,ne=Math.min(B.start,J);B=B.end===void 0?ne:Math.min(B.end,J),!g.extend&&ne>B&&(J=B,B=ne,ne=J),J=As(E,ne);var ge=As(E,B);J&&ge&&(g.rangeCount!==1||g.anchorNode!==J.node||g.anchorOffset!==J.offset||g.focusNode!==ge.node||g.focusOffset!==ge.offset)&&(y=y.createRange(),y.setStart(J.node,J.offset),g.removeAllRanges(),ne>B?(g.addRange(y),g.extend(ge.node,ge.offset)):(y.setEnd(ge.node,ge.offset),g.addRange(y)))}}for(y=[],g=E;g=g.parentNode;)g.nodeType===1&&y.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E=document.documentMode,dl=null,Nc=null,Rc=null,dg=!1;function Vv(g,y,E){var B=E.window===E?E.document:E.nodeType===9?E:E.ownerDocument;dg||dl==null||dl!==ke(B)||(B=dl,"selectionStart"in B&&ri(B)?B={start:B.selectionStart,end:B.selectionEnd}:(B=(B.ownerDocument&&B.ownerDocument.defaultView||window).getSelection(),B={anchorNode:B.anchorNode,anchorOffset:B.anchorOffset,focusNode:B.focusNode,focusOffset:B.focusOffset}),Rc&&ul(Rc,B)||(Rc=B,B=hg(Nc,"onSelect"),0Ul||(g.current=ny[Ul],ny[Ul]=null,Ul--)}function mn(g,y){Ul++,ny[Ul]=g.current,g.current=y}var zc={},ao=Ts(zc),oa=Ts(!1),Bu=zc;function ef(g,y){var E=g.type.contextTypes;if(!E)return zc;var B=g.stateNode;if(B&&B.__reactInternalMemoizedUnmaskedChildContext===y)return B.__reactInternalMemoizedMaskedChildContext;var J={},ne;for(ne in E)J[ne]=y[ne];return B&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=y,g.__reactInternalMemoizedMaskedChildContext=J),J}function aa(g){return g=g.childContextTypes,g!=null}function mg(){pn(oa),pn(ao)}function a0(g,y,E){if(ao.current!==zc)throw Error(r(168));mn(ao,y),mn(oa,E)}function iy(g,y,E){var B=g.stateNode;if(y=y.childContextTypes,typeof B.getChildContext!="function")return E;B=B.getChildContext();for(var J in B)if(!(J in y))throw Error(r(108,K(g)||"Unknown",J));return V({},E,B)}function Wu(g){return g=(g=g.stateNode)&&g.__reactInternalMemoizedMergedChildContext||zc,Bu=ao.current,mn(ao,g),mn(oa,oa.current),!0}function s0(g,y,E){var B=g.stateNode;if(!B)throw Error(r(169));E?(g=iy(g,y,Bu),B.__reactInternalMemoizedMergedChildContext=g,pn(oa),pn(ao),mn(ao,g)):pn(oa),mn(oa,E)}var Hl=null,Sp=!1,L=!1;function W(g){Hl===null?Hl=[g]:Hl.push(g)}function te(g){Sp=!0,W(g)}function oe(){if(!L&&Hl!==null){L=!0;var g=0,y=zr;try{var E=Hl;for(zr=1;g>=ge,J-=ge,it=1<<32-Gr(y)+J|E<Cr?(Eo=vr,vr=null):Eo=vr.sibling;var sn=Rt(ot,vr,ut[Cr],Dt);if(sn===null){vr===null&&(vr=Eo);break}g&&vr&&sn.alternate===null&&y(ot,vr),Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn,vr=Eo}if(Cr===ut.length)return E(ot,vr),_t&&Ze(ot,Cr),cr;if(vr===null){for(;CrCr?(Eo=vr,vr=null):Eo=vr.sibling;var ff=Rt(ot,vr,sn.value,Dt);if(ff===null){vr===null&&(vr=Eo);break}g&&vr&&ff.alternate===null&&y(ot,vr),Je=ne(ff,Je,Cr),mr===null?cr=ff:mr.sibling=ff,mr=ff,vr=Eo}if(sn.done)return E(ot,vr),_t&&Ze(ot,Cr),cr;if(vr===null){for(;!sn.done;Cr++,sn=ut.next())sn=zt(ot,sn.value,Dt),sn!==null&&(Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn);return _t&&Ze(ot,Cr),cr}for(vr=B(ot,vr);!sn.done;Cr++,sn=ut.next())sn=Yt(vr,ot,Cr,sn.value,Dt),sn!==null&&(g&&sn.alternate!==null&&vr.delete(sn.key===null?Cr:sn.key),Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn);return g&&vr.forEach(function(kJ){return y(ot,kJ)}),_t&&Ze(ot,Cr),cr}function Wi(ot,Je,ut,Dt){if(typeof ut=="object"&&ut!==null&&ut.type===A&&ut.key===null&&(ut=ut.props.children),typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case _:e:{for(var cr=ut.key,mr=Je;mr!==null;){if(mr.key===cr){if(cr=ut.type,cr===A){if(mr.tag===7){E(ot,mr.sibling),Je=J(mr,ut.props.children),Je.return=ot,ot=Je;break e}}else if(mr.elementType===cr||typeof cr=="object"&&cr!==null&&cr.$$typeof===Y&&Rn(cr)===mr.type){E(ot,mr.sibling),Je=J(mr,ut.props),Je.ref=wr(ot,mr,ut),Je.return=ot,ot=Je;break e}E(ot,mr);break}else y(ot,mr);mr=mr.sibling}ut.type===A?(Je=Pp(ut.props.children,ot.mode,Dt,ut.key),Je.return=ot,ot=Je):(Dt=E0(ut.type,ut.key,ut.props,null,ot.mode,Dt),Dt.ref=wr(ot,Je,ut),Dt.return=ot,ot=Dt)}return ge(ot);case T:e:{for(mr=ut.key;Je!==null;){if(Je.key===mr)if(Je.tag===4&&Je.stateNode.containerInfo===ut.containerInfo&&Je.stateNode.implementation===ut.implementation){E(ot,Je.sibling),Je=J(Je,ut.children||[]),Je.return=ot,ot=Je;break e}else{E(ot,Je);break}else y(ot,Je);Je=Je.sibling}Je=Xj(ut,ot.mode,Dt),Je.return=ot,ot=Je}return ge(ot);case Y:return mr=ut._init,Wi(ot,Je,mr(ut._payload),Dt)}if(Me(ut))return rr(ot,Je,ut,Dt);if(ee(ut))return ar(ot,Je,ut,Dt);Dr(ot,ut)}return typeof ut=="string"&&ut!==""||typeof ut=="number"?(ut=""+ut,Je!==null&&Je.tag===6?(E(ot,Je.sibling),Je=J(Je,ut),Je.return=ot,ot=Je):(E(ot,Je),Je=Qj(ut,ot.mode,Dt),Je.return=ot,ot=Je),ge(ot)):E(ot,Je)}return Wi}var Ci=Qi(!0),ni=Qi(!1),Di=Ts(null),Xi=null,Un=null,Hr=null;function tn(){Hr=Un=Xi=null}function Hn(g){var y=Di.current;pn(Di),g._currentValue=y}function rn(g,y,E){for(;g!==null;){var B=g.alternate;if((g.childLanes&y)!==y?(g.childLanes|=y,B!==null&&(B.childLanes|=y)):B!==null&&(B.childLanes&y)!==y&&(B.childLanes|=y),g===E)break;g=g.return}}function ci(g,y){Xi=g,Hr=Un=null,g=g.dependencies,g!==null&&g.firstContext!==null&&((g.lanes&y)!==0&&(rs=!0),g.firstContext=null)}function ui(g){var y=g._currentValue;if(Hr!==g)if(g={context:g,memoizedValue:y,next:null},Un===null){if(Xi===null)throw Error(r(308));Un=g,Xi.dependencies={lanes:0,firstContext:g}}else Un=Un.next=g;return y}var An=null;function jo(g){An===null?An=[g]:An.push(g)}function vn(g,y,E,B){var J=y.interleaved;return J===null?(E.next=E,jo(y)):(E.next=J.next,J.next=E),y.interleaved=E,Tn(g,B)}function Tn(g,y){g.lanes|=y;var E=g.alternate;for(E!==null&&(E.lanes|=y),E=g,g=g.return;g!==null;)g.childLanes|=y,E=g.alternate,E!==null&&(E.childLanes|=y),E=g,g=g.return;return E.tag===3?E.stateNode:null}var Ei=!1;function so(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function sa(g,y){g=g.updateQueue,y.updateQueue===g&&(y.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,effects:g.effects})}function gi(g,y){return{eventTime:g,lane:y,tag:0,payload:null,callback:null,next:null}}function mi(g,y,E){var B=g.updateQueue;if(B===null)return null;if(B=B.shared,(nn&2)!==0){var J=B.pending;return J===null?y.next=y:(y.next=J.next,J.next=y),B.pending=y,Tn(g,E)}return J=B.interleaved,J===null?(y.next=y,jo(B)):(y.next=J.next,J.next=y),B.interleaved=y,Tn(g,E)}function ko(g,y,E){if(y=y.updateQueue,y!==null&&(y=y.shared,(E&4194240)!==0)){var B=y.lanes;B&=g.pendingLanes,E|=B,y.lanes=E,ap(g,E)}}function Pn(g,y){var E=g.updateQueue,B=g.alternate;if(B!==null&&(B=B.updateQueue,E===B)){var J=null,ne=null;if(E=E.firstBaseUpdate,E!==null){do{var ge={eventTime:E.eventTime,lane:E.lane,tag:E.tag,payload:E.payload,callback:E.callback,next:null};ne===null?J=ne=ge:ne=ne.next=ge,E=E.next}while(E!==null);ne===null?J=ne=y:ne=ne.next=y}else J=ne=y;E={baseState:B.baseState,firstBaseUpdate:J,lastBaseUpdate:ne,shared:B.shared,effects:B.effects},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=y:g.next=y,E.lastBaseUpdate=y}function _o(g,y,E,B){var J=g.updateQueue;Ei=!1;var ne=J.firstBaseUpdate,ge=J.lastBaseUpdate,Fe=J.shared.pending;if(Fe!==null){J.shared.pending=null;var Ke=Fe,pt=Ke.next;Ke.next=null,ge===null?ne=pt:ge.next=pt,ge=Ke;var Lt=g.alternate;Lt!==null&&(Lt=Lt.updateQueue,Fe=Lt.lastBaseUpdate,Fe!==ge&&(Fe===null?Lt.firstBaseUpdate=pt:Fe.next=pt,Lt.lastBaseUpdate=Ke))}if(ne!==null){var zt=J.baseState;ge=0,Lt=pt=Ke=null,Fe=ne;do{var Rt=Fe.lane,Yt=Fe.eventTime;if((B&Rt)===Rt){Lt!==null&&(Lt=Lt.next={eventTime:Yt,lane:0,tag:Fe.tag,payload:Fe.payload,callback:Fe.callback,next:null});e:{var rr=g,ar=Fe;switch(Rt=y,Yt=E,ar.tag){case 1:if(rr=ar.payload,typeof rr=="function"){zt=rr.call(Yt,zt,Rt);break e}zt=rr;break e;case 3:rr.flags=rr.flags&-65537|128;case 0:if(rr=ar.payload,Rt=typeof rr=="function"?rr.call(Yt,zt,Rt):rr,Rt==null)break e;zt=V({},zt,Rt);break e;case 2:Ei=!0}}Fe.callback!==null&&Fe.lane!==0&&(g.flags|=64,Rt=J.effects,Rt===null?J.effects=[Fe]:Rt.push(Fe))}else Yt={eventTime:Yt,lane:Rt,tag:Fe.tag,payload:Fe.payload,callback:Fe.callback,next:null},Lt===null?(pt=Lt=Yt,Ke=zt):Lt=Lt.next=Yt,ge|=Rt;if(Fe=Fe.next,Fe===null){if(Fe=J.shared.pending,Fe===null)break;Rt=Fe,Fe=Rt.next,Rt.next=null,J.lastBaseUpdate=Rt,J.shared.pending=null}}while(!0);if(Lt===null&&(Ke=zt),J.baseState=Ke,J.firstBaseUpdate=pt,J.lastBaseUpdate=Lt,y=J.shared.interleaved,y!==null){J=y;do ge|=J.lane,J=J.next;while(J!==y)}else ne===null&&(J.shared.lanes=0);Cp|=ge,g.lanes=ge,g.memoizedState=zt}}function ts(g,y,E){if(g=y.effects,y.effects=null,g!==null)for(y=0;yE?E:4,g(!0);var B=yg.transition;yg.transition={};try{g(!1),y()}finally{zr=E,yg.transition=B}}function xI(){return Ia().memoizedState}function GZ(g,y,E){var B=cf(g);if(E={lane:B,action:E,hasEagerState:!1,eagerState:null,next:null},bI(g))wI(y,E);else if(E=vn(g,y,E,B),E!==null){var J=Ra();Zl(E,g,B,J),SI(E,y,B)}}function KZ(g,y,E){var B=cf(g),J={lane:B,action:E,hasEagerState:!1,eagerState:null,next:null};if(bI(g))wI(y,J);else{var ne=g.alternate;if(g.lanes===0&&(ne===null||ne.lanes===0)&&(ne=y.lastRenderedReducer,ne!==null))try{var ge=y.lastRenderedState,Fe=ne(ge,E);if(J.hasEagerState=!0,J.eagerState=Fe,Ki(Fe,ge)){var Ke=y.interleaved;Ke===null?(J.next=J,jo(y)):(J.next=Ke.next,Ke.next=J),y.interleaved=J;return}}catch{}finally{}E=vn(g,y,J,B),E!==null&&(J=Ra(),Zl(E,g,B,J),SI(E,y,B))}}function bI(g){var y=g.alternate;return g===Vn||y!==null&&y===Vn}function wI(g,y){Yl=rf=!0;var E=g.pending;E===null?y.next=y:(y.next=E.next,E.next=y),g.pending=y}function SI(g,y,E){if((E&4194240)!==0){var B=y.lanes;B&=g.pendingLanes,E|=B,y.lanes=E,ap(g,E)}}var p0={readContext:ui,useCallback:Bi,useContext:Bi,useEffect:Bi,useImperativeHandle:Bi,useInsertionEffect:Bi,useLayoutEffect:Bi,useMemo:Bi,useReducer:Bi,useRef:Bi,useState:Bi,useDebugValue:Bi,useDeferredValue:Bi,useTransition:Bi,useMutableSource:Bi,useSyncExternalStore:Bi,useId:Bi,unstable_isNewReconciler:!1},QZ={readContext:ui,useCallback:function(g,y){return Os().memoizedState=[g,y===void 0?null:y],g},useContext:ui,useEffect:Sg,useImperativeHandle:function(g,y,E){return E=E!=null?E.concat([g]):null,Ns(4194308,4,_g.bind(null,y,g),E)},useLayoutEffect:function(g,y){return Ns(4194308,4,g,y)},useInsertionEffect:function(g,y){return Ns(4,2,g,y)},useMemo:function(g,y){var E=Os();return y=y===void 0?null:y,g=g(),E.memoizedState=[g,y],g},useReducer:function(g,y,E){var B=Os();return y=E!==void 0?E(y):y,B.memoizedState=B.baseState=y,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:y},B.queue=g,g=g.dispatch=GZ.bind(null,Vn,g),[B.memoizedState,g]},useRef:function(g){var y=Os();return g={current:g},y.memoizedState=g},useState:_p,useDebugValue:jj,useDeferredValue:function(g){return Os().memoizedState=g},useTransition:function(){var g=_p(!1),y=g[0];return g=YZ.bind(null,g[1]),Os().memoizedState=g,[y,g]},useMutableSource:function(){},useSyncExternalStore:function(g,y,E){var B=Vn,J=Os();if(_t){if(E===void 0)throw Error(r(407));E=E()}else{if(E=y(),Co===null)throw Error(r(349));(gl&30)!==0||u0(B,y,E)}J.memoizedState=E;var ne={value:E,getSnapshot:y};return J.queue=ne,Sg(d0.bind(null,B,ne,g),[g]),B.flags|=2048,Oa(9,cy.bind(null,B,ne,E,y),void 0,null),E},useId:function(){var g=Os(),y=Co.identifierPrefix;if(_t){var E=Ne,B=it;E=(B&~(1<<32-Gr(B)-1)).toString(32)+E,y=":"+y+"R"+E,E=nf++,0<\/script>",g=g.removeChild(g.firstChild)):typeof B.is=="string"?g=ge.createElement(E,{is:B.is}):(g=ge.createElement(E),E==="select"&&(ge=g,B.multiple?ge.multiple=!0:B.size&&(ge.size=B.size))):g=ge.createElementNS(g,E),g[pl]=y,g[Zd]=B,qI(g,y,!1,!1),y.stateNode=g;e:{switch(ge=Ce(E,B),E){case"dialog":En("cancel",g),En("close",g),J=B;break;case"iframe":case"object":case"embed":En("load",g),J=B;break;case"video":case"audio":for(J=0;JTg&&(y.flags|=128,B=!0,uy(ne,!1),y.lanes=4194304)}else{if(!B)if(g=Is(ge),g!==null){if(y.flags|=128,B=!0,E=g.updateQueue,E!==null&&(y.updateQueue=E,y.flags|=4),uy(ne,!0),ne.tail===null&&ne.tailMode==="hidden"&&!ge.alternate&&!_t)return la(y),null}else 2*jn()-ne.renderingStartTime>Tg&&E!==1073741824&&(y.flags|=128,B=!0,uy(ne,!1),y.lanes=4194304);ne.isBackwards?(ge.sibling=y.child,y.child=ge):(E=ne.last,E!==null?E.sibling=ge:y.child=ge,ne.last=ge)}return ne.tail!==null?(y=ne.tail,ne.rendering=y,ne.tail=y.sibling,ne.renderingStartTime=jn(),y.sibling=null,E=Dn.current,mn(Dn,B?E&1|2:E&1),y):(la(y),null);case 22:case 23:return Yj(),B=y.memoizedState!==null,g!==null&&g.memoizedState!==null!==B&&(y.flags|=8192),B&&(y.mode&1)!==0?(Rs&1073741824)!==0&&(la(y),y.subtreeFlags&6&&(y.flags|=8192)):la(y),null;case 24:return null;case 25:return null}throw Error(r(156,y.tag))}function iJ(g,y){switch(at(y),y.tag){case 1:return aa(y.type)&&mg(),g=y.flags,g&65536?(y.flags=g&-65537|128,y):null;case 3:return hl(),pn(oa),pn(ao),sy(),g=y.flags,(g&65536)!==0&&(g&128)===0?(y.flags=g&-65537|128,y):null;case 5:return oy(y),null;case 13:if(pn(Dn),g=y.memoizedState,g!==null&&g.dehydrated!==null){if(y.alternate===null)throw Error(r(340));Qt()}return g=y.flags,g&65536?(y.flags=g&-65537|128,y):null;case 19:return pn(Dn),null;case 4:return hl(),null;case 10:return Hn(y.type._context),null;case 22:case 23:return Yj(),null;case 24:return null;default:return null}}var v0=!1,ca=!1,oJ=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function Eg(g,y){var E=g.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(B){Ti(g,y,B)}else E.current=null}function Lj(g,y,E){try{E()}catch(B){Ti(g,y,B)}}var HI=!1;function aJ(g,y){if(bp=Dd,g=Cn(),ri(g)){if("selectionStart"in g)var E={start:g.selectionStart,end:g.selectionEnd};else e:{E=(E=g.ownerDocument)&&E.defaultView||window;var B=E.getSelection&&E.getSelection();if(B&&B.rangeCount!==0){E=B.anchorNode;var J=B.anchorOffset,ne=B.focusNode;B=B.focusOffset;try{E.nodeType,ne.nodeType}catch{E=null;break e}var ge=0,Fe=-1,Ke=-1,pt=0,Lt=0,zt=g,Rt=null;t:for(;;){for(var Yt;zt!==E||J!==0&&zt.nodeType!==3||(Fe=ge+J),zt!==ne||B!==0&&zt.nodeType!==3||(Ke=ge+B),zt.nodeType===3&&(ge+=zt.nodeValue.length),(Yt=zt.firstChild)!==null;)Rt=zt,zt=Yt;for(;;){if(zt===g)break t;if(Rt===E&&++pt===J&&(Fe=ge),Rt===ne&&++Lt===B&&(Ke=ge),(Yt=zt.nextSibling)!==null)break;zt=Rt,Rt=zt.parentNode}zt=Yt}E=Fe===-1||Ke===-1?null:{start:Fe,end:Ke}}else E=null}E=E||{start:0,end:0}}else E=null;for(Mu={focusedElem:g,selectionRange:E},Dd=!1,Zt=y;Zt!==null;)if(y=Zt,g=y.child,(y.subtreeFlags&1028)!==0&&g!==null)g.return=y,Zt=g;else for(;Zt!==null;){y=Zt;try{var rr=y.alternate;if((y.flags&1024)!==0)switch(y.tag){case 0:case 11:case 15:break;case 1:if(rr!==null){var ar=rr.memoizedProps,Wi=rr.memoizedState,ot=y.stateNode,Je=ot.getSnapshotBeforeUpdate(y.elementType===y.type?ar:Kl(y.type,ar),Wi);ot.__reactInternalSnapshotBeforeUpdate=Je}break;case 3:var ut=y.stateNode.containerInfo;ut.nodeType===1?ut.textContent="":ut.nodeType===9&&ut.documentElement&&ut.removeChild(ut.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Dt){Ti(y,y.return,Dt)}if(g=y.sibling,g!==null){g.return=y.return,Zt=g;break}Zt=y.return}return rr=HI,HI=!1,rr}function dy(g,y,E){var B=y.updateQueue;if(B=B!==null?B.lastEffect:null,B!==null){var J=B=B.next;do{if((J.tag&g)===g){var ne=J.destroy;J.destroy=void 0,ne!==void 0&&Lj(y,E,ne)}J=J.next}while(J!==B)}}function y0(g,y){if(y=y.updateQueue,y=y!==null?y.lastEffect:null,y!==null){var E=y=y.next;do{if((E.tag&g)===g){var B=E.create;E.destroy=B()}E=E.next}while(E!==y)}}function Fj(g){var y=g.ref;if(y!==null){var E=g.stateNode;switch(g.tag){case 5:g=E;break;default:g=E}typeof y=="function"?y(g):y.current=g}}function VI(g){var y=g.alternate;y!==null&&(g.alternate=null,VI(y)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(y=g.stateNode,y!==null&&(delete y[pl],delete y[Zd],delete y[ia],delete y[bj],delete y[wj])),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 YI(g){return g.tag===5||g.tag===3||g.tag===4}function GI(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||YI(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 zj(g,y,E){var B=g.tag;if(B===5||B===6)g=g.stateNode,y?E.nodeType===8?E.parentNode.insertBefore(g,y):E.insertBefore(g,y):(E.nodeType===8?(y=E.parentNode,y.insertBefore(g,E)):(y=E,y.appendChild(g)),E=E._reactRootContainer,E!=null||y.onclick!==null||(y.onclick=Xd));else if(B!==4&&(g=g.child,g!==null))for(zj(g,y,E),g=g.sibling;g!==null;)zj(g,y,E),g=g.sibling}function Mj(g,y,E){var B=g.tag;if(B===5||B===6)g=g.stateNode,y?E.insertBefore(g,y):E.appendChild(g);else if(B!==4&&(g=g.child,g!==null))for(Mj(g,y,E),g=g.sibling;g!==null;)Mj(g,y,E),g=g.sibling}var Ko=null,Ql=!1;function af(g,y,E){for(E=E.child;E!==null;)KI(g,y,E),E=E.sibling}function KI(g,y,E){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(Wt,E)}catch{}switch(E.tag){case 5:ca||Eg(E,y);case 6:var B=Ko,J=Ql;Ko=null,af(g,y,E),Ko=B,Ql=J,Ko!==null&&(Ql?(g=Ko,E=E.stateNode,g.nodeType===8?g.parentNode.removeChild(E):g.removeChild(E)):Ko.removeChild(E.stateNode));break;case 18:Ko!==null&&(Ql?(g=Ko,E=E.stateNode,g.nodeType===8?ry(g.parentNode,E):g.nodeType===1&&ry(g,E),Dl(g)):ry(Ko,E.stateNode));break;case 4:B=Ko,J=Ql,Ko=E.stateNode.containerInfo,Ql=!0,af(g,y,E),Ko=B,Ql=J;break;case 0:case 11:case 14:case 15:if(!ca&&(B=E.updateQueue,B!==null&&(B=B.lastEffect,B!==null))){J=B=B.next;do{var ne=J,ge=ne.destroy;ne=ne.tag,ge!==void 0&&((ne&2)!==0||(ne&4)!==0)&&Lj(E,y,ge),J=J.next}while(J!==B)}af(g,y,E);break;case 1:if(!ca&&(Eg(E,y),B=E.stateNode,typeof B.componentWillUnmount=="function"))try{B.props=E.memoizedProps,B.state=E.memoizedState,B.componentWillUnmount()}catch(Fe){Ti(E,y,Fe)}af(g,y,E);break;case 21:af(g,y,E);break;case 22:E.mode&1?(ca=(B=ca)||E.memoizedState!==null,af(g,y,E),ca=B):af(g,y,E);break;default:af(g,y,E)}}function QI(g){var y=g.updateQueue;if(y!==null){g.updateQueue=null;var E=g.stateNode;E===null&&(E=g.stateNode=new oJ),y.forEach(function(B){var J=gJ.bind(null,g,B);E.has(B)||(E.add(B),B.then(J,J))})}}function Xl(g,y){var E=y.deletions;if(E!==null)for(var B=0;BJ&&(J=ge),B&=~ne}if(B=J,B=jn()-B,B=(120>B?120:480>B?480:1080>B?1080:1920>B?1920:3e3>B?3e3:4320>B?4320:1960*lJ(B/1960))-B,10g?16:g,lf===null)var B=!1;else{if(g=lf,lf=null,j0=0,(nn&6)!==0)throw Error(r(331));var J=nn;for(nn|=4,Zt=g.current;Zt!==null;){var ne=Zt,ge=ne.child;if((Zt.flags&16)!==0){var Fe=ne.deletions;if(Fe!==null){for(var Ke=0;Kejn()-Wj?Ap(g,0):Bj|=E),is(g,y)}function cO(g,y){y===0&&((g.mode&1)===0?y=1:(y=Ea,Ea<<=1,(Ea&130023424)===0&&(Ea=4194304)));var E=Ra();g=Tn(g,y),g!==null&&(vu(g,y,E),is(g,E))}function hJ(g){var y=g.memoizedState,E=0;y!==null&&(E=y.retryLane),cO(g,E)}function gJ(g,y){var E=0;switch(g.tag){case 13:var B=g.stateNode,J=g.memoizedState;J!==null&&(E=J.retryLane);break;case 19:B=g.stateNode;break;default:throw Error(r(314))}B!==null&&B.delete(y),cO(g,E)}var uO;uO=function(g,y,E){if(g!==null)if(g.memoizedProps!==y.pendingProps||oa.current)rs=!0;else{if((g.lanes&E)===0&&(y.flags&128)===0)return rs=!1,rJ(g,y,E);rs=(g.flags&131072)!==0}else rs=!1,_t&&(y.flags&1048576)!==0&&nt(y,we,y.index);switch(y.lanes=0,y.tag){case 2:var B=y.type;m0(g,y),g=y.pendingProps;var J=ef(y,ao.current);ci(y,E),J=jp(null,y,B,g,J,E);var ne=ml();return y.flags|=1,typeof J=="object"&&J!==null&&typeof J.render=="function"&&J.$$typeof===void 0?(y.tag=1,y.memoizedState=null,y.updateQueue=null,aa(B)?(ne=!0,Wu(y)):ne=!1,y.memoizedState=J.state!==null&&J.state!==void 0?J.state:null,so(y),J.updater=h0,y.stateNode=J,J._reactInternals=y,_j(y,B,g,E),y=Tj(null,y,B,!0,ne,E)):(y.tag=0,_t&&ne&&bt(y),Na(null,y,J,E),y=y.child),y;case 16:B=y.elementType;e:{switch(m0(g,y),g=y.pendingProps,J=B._init,B=J(B._payload),y.type=B,J=y.tag=vJ(B),g=Kl(B,g),J){case 0:y=Aj(null,y,B,g,E);break e;case 1:y=FI(null,y,B,g,E);break e;case 11:y=II(null,y,B,g,E);break e;case 14:y=OI(null,y,B,Kl(B.type,g),E);break e}throw Error(r(306,B,""))}return y;case 0:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),Aj(g,y,B,J,E);case 1:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),FI(g,y,B,J,E);case 3:e:{if(zI(y),g===null)throw Error(r(387));B=y.pendingProps,ne=y.memoizedState,J=ne.element,sa(g,y),_o(y,B,null,E);var ge=y.memoizedState;if(B=ge.element,ne.isDehydrated)if(ne={element:B,isDehydrated:!1,cache:ge.cache,pendingSuspenseBoundaries:ge.pendingSuspenseBoundaries,transitions:ge.transitions},y.updateQueue.baseState=ne,y.memoizedState=ne,y.flags&256){J=Cg(Error(r(423)),y),y=MI(g,y,B,E,J);break e}else if(B!==J){J=Cg(Error(r(424)),y),y=MI(g,y,B,E,J);break e}else for(yt=Go(y.stateNode.containerInfo.firstChild),gt=y,_t=!0,At=null,E=ni(y,null,B,E),y.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Qt(),B===J){y=$u(g,y,E);break e}Na(g,y,B,E)}y=y.child}return y;case 5:return l0(y),g===null&&er(y),B=y.type,J=y.pendingProps,ne=g!==null?g.memoizedProps:null,ge=J.children,ey(B,J)?ge=null:ne!==null&&ey(B,ne)&&(y.flags|=32),LI(g,y),Na(g,y,ge,E),y.child;case 6:return g===null&&er(y),null;case 13:return DI(g,y,E);case 4:return tf(y,y.stateNode.containerInfo),B=y.pendingProps,g===null?y.child=Ci(y,null,B,E):Na(g,y,B,E),y.child;case 11:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),II(g,y,B,J,E);case 7:return Na(g,y,y.pendingProps,E),y.child;case 8:return Na(g,y,y.pendingProps.children,E),y.child;case 12:return Na(g,y,y.pendingProps.children,E),y.child;case 10:e:{if(B=y.type._context,J=y.pendingProps,ne=y.memoizedProps,ge=J.value,mn(Di,B._currentValue),B._currentValue=ge,ne!==null)if(Ki(ne.value,ge)){if(ne.children===J.children&&!oa.current){y=$u(g,y,E);break e}}else for(ne=y.child,ne!==null&&(ne.return=y);ne!==null;){var Fe=ne.dependencies;if(Fe!==null){ge=ne.child;for(var Ke=Fe.firstContext;Ke!==null;){if(Ke.context===B){if(ne.tag===1){Ke=gi(-1,E&-E),Ke.tag=2;var pt=ne.updateQueue;if(pt!==null){pt=pt.shared;var Lt=pt.pending;Lt===null?Ke.next=Ke:(Ke.next=Lt.next,Lt.next=Ke),pt.pending=Ke}}ne.lanes|=E,Ke=ne.alternate,Ke!==null&&(Ke.lanes|=E),rn(ne.return,E,y),Fe.lanes|=E;break}Ke=Ke.next}}else if(ne.tag===10)ge=ne.type===y.type?null:ne.child;else if(ne.tag===18){if(ge=ne.return,ge===null)throw Error(r(341));ge.lanes|=E,Fe=ge.alternate,Fe!==null&&(Fe.lanes|=E),rn(ge,E,y),ge=ne.sibling}else ge=ne.child;if(ge!==null)ge.return=ne;else for(ge=ne;ge!==null;){if(ge===y){ge=null;break}if(ne=ge.sibling,ne!==null){ne.return=ge.return,ge=ne;break}ge=ge.return}ne=ge}Na(g,y,J.children,E),y=y.child}return y;case 9:return J=y.type,B=y.pendingProps.children,ci(y,E),J=ui(J),B=B(J),y.flags|=1,Na(g,y,B,E),y.child;case 14:return B=y.type,J=Kl(B,y.pendingProps),J=Kl(B.type,J),OI(g,y,B,J,E);case 15:return NI(g,y,y.type,y.pendingProps,E);case 17:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),m0(g,y),y.tag=1,aa(B)?(g=!0,Wu(y)):g=!1,ci(y,E),kI(y,B,J),_j(y,B,J,E),Tj(null,y,B,!0,g,E);case 19:return WI(g,y,E);case 22:return RI(g,y,E)}throw Error(r(156,y.tag))};function dO(g,y){return Ca(g,y)}function mJ(g,y,E,B){this.tag=g,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=y,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=B,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yl(g,y,E,B){return new mJ(g,y,E,B)}function Kj(g){return g=g.prototype,!(!g||!g.isReactComponent)}function vJ(g){if(typeof g=="function")return Kj(g)?1:0;if(g!=null){if(g=g.$$typeof,g===I)return 11;if(g===M)return 14}return 2}function df(g,y){var E=g.alternate;return E===null?(E=yl(g.tag,y,g.key,g.mode),E.elementType=g.elementType,E.type=g.type,E.stateNode=g.stateNode,E.alternate=g,g.alternate=E):(E.pendingProps=y,E.type=g.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=g.flags&14680064,E.childLanes=g.childLanes,E.lanes=g.lanes,E.child=g.child,E.memoizedProps=g.memoizedProps,E.memoizedState=g.memoizedState,E.updateQueue=g.updateQueue,y=g.dependencies,E.dependencies=y===null?null:{lanes:y.lanes,firstContext:y.firstContext},E.sibling=g.sibling,E.index=g.index,E.ref=g.ref,E}function E0(g,y,E,B,J,ne){var ge=2;if(B=g,typeof g=="function")Kj(g)&&(ge=1);else if(typeof g=="string")ge=5;else e:switch(g){case A:return Pp(E.children,J,ne,y);case P:ge=8,J|=8;break;case N:return g=yl(12,E,y,J|2),g.elementType=N,g.lanes=ne,g;case R:return g=yl(13,E,y,J),g.elementType=R,g.lanes=ne,g;case F:return g=yl(19,E,y,J),g.elementType=F,g.lanes=ne,g;case X:return A0(E,J,ne,y);default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case O:ge=10;break e;case C:ge=9;break e;case I:ge=11;break e;case M:ge=14;break e;case Y:ge=16,B=null;break e}throw Error(r(130,g==null?g:typeof g,""))}return y=yl(ge,E,y,J),y.elementType=g,y.type=B,y.lanes=ne,y}function Pp(g,y,E,B){return g=yl(7,g,B,y),g.lanes=E,g}function A0(g,y,E,B){return g=yl(22,g,B,y),g.elementType=X,g.lanes=E,g.stateNode={isHidden:!1},g}function Qj(g,y,E){return g=yl(6,g,null,y),g.lanes=E,g}function Xj(g,y,E){return y=yl(4,g.children!==null?g.children:[],g.key,y),y.lanes=E,y.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},y}function yJ(g,y,E,B,J){this.tag=y,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=zd(0),this.expirationTimes=zd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zd(0),this.identifierPrefix=B,this.onRecoverableError=J,this.mutableSourceEagerHydrationData=null}function Zj(g,y,E,B,J,ne,ge,Fe,Ke){return g=new yJ(g,y,E,Fe,Ke),y===1?(y=1,ne===!0&&(y|=8)):y=0,ne=yl(3,null,null,y),g.current=ne,ne.stateNode=g,ne.memoizedState={element:B,isDehydrated:E,cache:null,transitions:null,pendingSuspenseBoundaries:null},so(ne),g}function xJ(g,y,E){var B=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),i5.exports=NJ(),i5.exports}var _O;function RJ(){if(_O)return F0;_O=1;var e=nT();return F0.createRoot=e.createRoot,F0.hydrateRoot=e.hydrateRoot,F0}var Hq=RJ(),S=Qw();const $e=dn(S),Vq=EJ({__proto__:null,default:$e},[S]);var iT=nT();const LJ=dn(iT);/** - * @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 xx(){return xx=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function oT(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zJ(){return Math.random().toString(36).substr(2,8)}function EO(e,t){return{usr:e.state,key:e.key,idx:t}}function S3(e,t,r,n){return r===void 0&&(r=null),xx({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?mv(t):t,{state:r,key:t&&t.key||n||zJ()})}function J1(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 mv(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 MJ(e,t,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,s=o.history,l=Ef.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(xx({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Ef.Pop;let b=d(),x=b==null?null:b-u;u=b,c&&c({action:l,location:m.location,delta:x})}function h(b,x){l=Ef.Push;let w=S3(m.location,b,x);u=d()+1;let k=EO(w,u),j=m.createHref(w);try{s.pushState(k,"",j)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;o.location.assign(j)}a&&c&&c({action:l,location:m.location,delta:1})}function p(b,x){l=Ef.Replace;let w=S3(m.location,b,x);u=d();let k=EO(w,u),j=m.createHref(w);s.replaceState(k,"",j),a&&c&&c({action:l,location:m.location,delta:0})}function v(b){let x=o.location.origin!=="null"?o.location.origin:o.location.href,w=typeof b=="string"?b:J1(b);return w=w.replace(/ $/,"%20"),xi(x,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,x)}let m={get action(){return l},get location(){return e(o,s)},listen(b){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(CO,f),c=b,()=>{o.removeEventListener(CO,f),c=null}},createHref(b){return t(o,b)},createURL:v,encodeLocation(b){let x=v(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:p,go(b){return s.go(b)}};return m}var AO;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(AO||(AO={}));function DJ(e,t,r){return r===void 0&&(r="/"),BJ(e,t,r)}function BJ(e,t,r,n){let o=typeof t=="string"?mv(t):t,a=Pm(o.pathname||"/",r);if(a==null)return null;let s=Yq(e);WJ(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("/")&&(xi(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=Rf([n,c.relativePath]),d=r.concat(c);a.children&&a.children.length>0&&(xi(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Yq(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:GJ(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 Gq(a.path))o(a,s,c)}),t}function Gq(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=Gq(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 WJ(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:KJ(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const qJ=/^:[\w-]+$/,$J=3,UJ=2,HJ=1,VJ=10,YJ=-2,TO=e=>e==="*";function GJ(e,t){let r=e.split("/"),n=r.length;return r.some(TO)&&(n+=YJ),t&&(n+=UJ),r.filter(o=>!TO(o)).reduce((o,a)=>o+(qJ.test(a)?$J:a===""?HJ:VJ),n)}function KJ(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 QJ(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 v=l[f];return p&&!v?u[h]=void 0:u[h]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:s,pattern:e}}function XJ(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),oT(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 ZJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oT(!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 Pm(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 JJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eee=e=>JJ.test(e);function tee(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?mv(e):e,a;if(r)if(eee(r))a=r;else{if(r.includes("//")){let s=r;r=r.replace(/\/\/+/g,"/"),oT(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+r))}r.startsWith("/")?a=PO(r.substring(1),"/"):a=PO(r,t)}else a=t;return{pathname:a,search:iee(n),hash:oee(o)}}function PO(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 s5(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 ree(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function aT(e,t){let r=ree(e);return t?r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function sT(e,t,r,n){n===void 0&&(n=!1);let o;typeof e=="string"?o=mv(e):(o=xx({},e),xi(!o.pathname||!o.pathname.includes("?"),s5("?","pathname","search",o)),xi(!o.pathname||!o.pathname.includes("#"),s5("#","pathname","hash",o)),xi(!o.search||!o.search.includes("#"),s5("#","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=tee(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(a||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Rf=e=>e.join("/").replace(/\/\/+/g,"/"),nee=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),iee=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oee=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function aee(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Kq=["post","put","patch","delete"];new Set(Kq);const see=["get",...Kq];new Set(see);/** - * 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 bx(){return bx=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let f=sT(u,JSON.parse(s),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Rf([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,s,a,e])}const uee=S.createContext(null);function dee(e){let t=S.useContext(uu).outlet;return t&&S.createElement(uee.Provider,{value:e},t)}function Jw(){let{matches:e}=S.useContext(uu),t=e[e.length-1];return t?t.params:{}}function eS(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=S.useContext(_d),{matches:o}=S.useContext(uu),{pathname:a}=Cd(),s=JSON.stringify(aT(o,n.v7_relativeSplatPath));return S.useMemo(()=>sT(e,JSON.parse(s),a,r==="path"),[e,s,a,r])}function fee(e,t){return pee(e,t)}function pee(e,t,r,n){vv()||xi(!1);let{navigator:o}=S.useContext(_d),{matches:a}=S.useContext(uu),s=a[a.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Cd(),d;if(t){var f;let b=typeof t=="string"?mv(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||xi(!1),d=b}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let b=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let v=DJ(e,{pathname:p}),m=yee(v&&v.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Rf([c,o.encodeLocation?o.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Rf([c,o.encodeLocation?o.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,r,n);return t&&m?S.createElement(Zw.Provider,{value:{location:bx({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ef.Pop}},m):m}function hee(){let e=See(),t=aee(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 S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),r?S.createElement("pre",{style:o},r):null,null)}const gee=S.createElement(hee,null);class mee extends S.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?S.createElement(uu.Provider,{value:this.props.routeContext},S.createElement(Xq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function vee(e){let{routeContext:t,match:r,children:n}=e,o=S.useContext(Xw);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(uu.Provider,{value:t},n)}function yee(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||xi(!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,v=!1,m=null,b=null;r&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||gee,c&&(u<0&&h===0?(kee("route-fallback"),v=!0,b=null):u===h&&(v=!0,b=f.route.hydrateFallbackElement||null)));let x=t.concat(s.slice(0,h+1)),w=()=>{let k;return p?k=m:v?k=b:f.route.Component?k=S.createElement(f.route.Component,null):f.route.element?k=f.route.element:k=d,S.createElement(vee,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:r!=null},children:k})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?S.createElement(mee,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):w()},null)}var Jq=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Jq||{}),e$=(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})(e$||{});function xee(e){let t=S.useContext(Xw);return t||xi(!1),t}function bee(e){let t=S.useContext(Qq);return t||xi(!1),t}function wee(e){let t=S.useContext(uu);return t||xi(!1),t}function t$(e){let t=wee(),r=t.matches[t.matches.length-1];return r.route.id||xi(!1),r.route.id}function See(){var e;let t=S.useContext(Xq),r=bee(),n=t$();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function jee(){let{router:e}=xee(Jq.UseNavigateStable),t=t$(e$.UseNavigateStable),r=S.useRef(!1);return Zq(()=>{r.current=!0}),S.useCallback(function(o,a){a===void 0&&(a={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,bx({fromRouteId:t},a)))},[e,t])}const IO={};function kee(e,t,r){IO[e]||(IO[e]=!0)}function _ee(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function gh(e){let{to:t,replace:r,state:n,relative:o}=e;vv()||xi(!1);let{future:a,static:s}=S.useContext(_d),{matches:l}=S.useContext(uu),{pathname:c}=Cd(),u=Ed(),d=sT(t,aT(l,a.v7_relativeSplatPath),c,o==="path"),f=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:o}),[u,f,o,r,n]),null}function r$(e){return dee(e.context)}function za(e){xi(!1)}function Cee(e){let{basename:t="/",children:r=null,location:n,navigationType:o=Ef.Pop,navigator:a,static:s=!1,future:l}=e;vv()&&xi(!1);let c=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:c,navigator:a,static:s,future:bx({v7_relativeSplatPath:!1},l)}),[c,l,a,s]);typeof n=="string"&&(n=mv(n));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:v="default"}=n,m=S.useMemo(()=>{let b=Pm(d,c);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:v},navigationType:o}},[c,d,f,h,p,v,o]);return m==null?null:S.createElement(_d.Provider,{value:u},S.createElement(Zw.Provider,{children:r,value:m}))}function Eee(e){let{children:t,location:r}=e;return fee(k3(t),r)}new Promise(()=>{});function k3(e,t){t===void 0&&(t=[]);let r=[];return S.Children.forEach(e,(n,o)=>{if(!S.isValidElement(n))return;let a=[...t,o];if(n.type===S.Fragment){r.push.apply(r,k3(n.props.children,a));return}n.type!==za&&xi(!1),!n.props.index||!n.props.children||xi(!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=k3(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 e2(){return e2=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[o]=e[o]);return r}function Aee(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tee(e,t){return e.button===0&&(!t||t==="_self")&&!Aee(e)}function _3(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 Pee(e,t){let r=_3(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}const Iee=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Oee=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Nee="6";try{window.__reactRouterVersion=Nee}catch{}const Ree=S.createContext({isTransitioning:!1}),Lee="startTransition",OO=Vq[Lee];function Fee(e){let{basename:t,children:r,future:n,window:o}=e,a=S.useRef();a.current==null&&(a.current=FJ({window:o,v5Compat:!0}));let s=a.current,[l,c]=S.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},d=S.useCallback(f=>{u&&OO?OO(()=>c(f)):c(f)},[c,u]);return S.useLayoutEffect(()=>s.listen(d),[s,d]),S.useEffect(()=>_ee(n),[n]),S.createElement(Cee,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}const zee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Mee=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dee=S.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=n$(t,Iee),{basename:p}=S.useContext(_d),v,m=!1;if(typeof u=="string"&&Mee.test(u)&&(v=u,zee))try{let k=new URL(window.location.href),j=u.startsWith("//")?new URL(k.protocol+u):new URL(u),_=Pm(j.pathname,p);j.origin===k.origin&&_!=null?u=_+j.search+j.hash:m=!0}catch{}let b=lee(u,{relative:o}),x=Wee(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,viewTransition:f});function w(k){n&&n(k),k.defaultPrevented||x(k)}return S.createElement("a",e2({},h,{href:v||b,onClick:m||a?n:w,ref:r,target:c}))}),NO=S.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=n$(t,Oee),h=eS(c,{relative:f.relative}),p=Cd(),v=S.useContext(Qq),{navigator:m,basename:b}=S.useContext(_d),x=v!=null&&qee(h)&&u===!0,w=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,k=p.pathname,j=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;o||(k=k.toLowerCase(),j=j?j.toLowerCase():null,w=w.toLowerCase()),j&&b&&(j=Pm(j,b)||j);const _=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let T=k===w||!s&&k.startsWith(w)&&k.charAt(_)==="/",A=j!=null&&(j===w||!s&&j.startsWith(w)&&j.charAt(w.length)==="/"),P={isActive:T,isPending:A,isTransitioning:x},N=T?n:void 0,O;typeof a=="function"?O=a(P):O=[a,T?"active":null,A?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let C=typeof l=="function"?l(P):l;return S.createElement(Dee,e2({},f,{"aria-current":N,className:O,ref:r,style:C,to:c,viewTransition:u}),typeof d=="function"?d(P):d)});var C3;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(C3||(C3={}));var RO;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(RO||(RO={}));function Bee(e){let t=S.useContext(Xw);return t||xi(!1),t}function Wee(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:s,viewTransition:l}=t===void 0?{}:t,c=Ed(),u=Cd(),d=eS(e,{relative:s});return S.useCallback(f=>{if(Tee(f,r)){f.preventDefault();let h=n!==void 0?n:J1(u)===J1(d);c(e,{replace:h,state:o,preventScrollReset:a,relative:s,viewTransition:l})}},[u,c,d,n,o,r,e,a,s,l])}function i$(e){let t=S.useRef(_3(e)),r=S.useRef(!1),n=Cd(),o=S.useMemo(()=>Pee(n.search,r.current?null:t.current),[n.search]),a=Ed(),s=S.useCallback((l,c)=>{const u=_3(typeof l=="function"?l(o):l);r.current=!0,a("?"+u,c)},[a,o]);return[o,s]}function qee(e,t){t===void 0&&(t={});let r=S.useContext(Ree);r==null&&xi(!1);let{basename:n}=Bee(C3.useViewTransitionState),o=eS(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=Pm(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Pm(r.nextLocation.pathname,n)||r.nextLocation.pathname;return j3(o.pathname,s)!=null||j3(o.pathname,a)!=null}const o$=S.createContext({theme:"light",setTheme:()=>{}});function $ee({children:e}){const[t,r]=S.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 S.useEffect(()=>{const o=document.documentElement;t==="dark"?o.classList.add("dark"):o.classList.remove("dark")},[t]),i.jsx(o$.Provider,{value:{theme:t,setTheme:n},children:e})}function a$(){return S.useContext(o$)}let t2=0;const E3=new Set;function s$(){E3.forEach(e=>e())}function Uee(e){return E3.add(e),()=>{E3.delete(e)}}function LO(){return t2>0}function l$(){t2+=1,s$()}function c$(){t2=Math.max(0,t2-1),s$()}const Hee=new Set(["POST","PUT","PATCH","DELETE"]);function u$(e){const t=(e||"GET").toUpperCase();return Hee.has(t)}const cd="https://api.eventbuzz.live/api",lT=cd,Im={access:"eventbuzz_access_token",refresh:"eventbuzz_refresh_token"};let Ol=null,ud=null;function d$(){try{const e=localStorage.getItem(Im.access),t=localStorage.getItem(Im.refresh);e&&t&&(Ol=e,ud=t)}catch{}}d$();function kf(e,t){Ol=e,ud=t;try{localStorage.setItem(Im.access,e),localStorage.setItem(Im.refresh,t)}catch{}}function f$(){Ol=null,ud=null;try{localStorage.removeItem(Im.access),localStorage.removeItem(Im.refresh)}catch{}}function Vee(){return Ol||(d$(),Ol)}function Yee(){return ud}async function p$(){var t;if(!ud)return!1;const e=lT.replace(/\/api\/?$/,"");try{const n=await(await fetch(`${e}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:ud})})).json();if(n.success&&((t=n.data)!=null&&t.token))return kf(n.data.token,ud),!0}catch{}return f$(),!1}async function Qg(e,t={}){var a;const{skipGlobalLoading:r,...n}=t,o=u$(n.method)&&!r;o&&l$();try{const s=e.startsWith("http")?e:`${lT}${e.startsWith("/")?e:`/${e}`}`,l={"Content-Type":"application/json",...typeof n.headers=="object"&&!(n.headers instanceof Headers)?n.headers:{}};Ol&&(l.Authorization=`Bearer ${Ol}`);let c=await fetch(s,{...n,headers:l});c.status===401&&ud&&await p$()&&(l.Authorization=`Bearer ${Ol}`,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&&c$()}}const Ve={get:e=>Qg(e,{method:"GET"}),post:(e,t)=>Qg(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Qg(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Qg(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Qg(e,{method:"DELETE"})};async function wh(e,t={}){const{skipGlobalLoading:r,...n}=t,o=u$(n.method)&&!r;o&&l$();try{const a=e.startsWith("http")?e:`${lT}${e.startsWith("/")?e:`/${e}`}`,s={...typeof n.headers=="object"&&n.headers&&!(n.headers instanceof Headers)?n.headers:{}};Ol&&(s.Authorization=`Bearer ${Ol}`),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&&ud&&await p$()&&(s.Authorization=`Bearer ${Ol}`,l=await fetch(a,{...n,headers:s})),l}finally{o&&c$()}}const Ma={async register(e){const t=await Ve.post("/auth/register",e);return t.data&&kf(t.data.token,t.data.refreshToken),t},async login(e,t){const r=await Ve.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&&kf(n.token,n.refreshToken),r},async googleLogin(e){const t=await Ve.post("/auth/google",{idToken:e}),r=t.data;return r&&"requiresTwoFactor"in r&&r.requiresTwoFactor||r&&"token"in r&&r.token&&"refreshToken"in r&&kf(r.token,r.refreshToken),t},async googleRegister(e){var r;const t=await Ve.post("/auth/google/register",e);return(r=t.data)!=null&&r.token&&t.data.refreshToken&&kf(t.data.token,t.data.refreshToken),t},async completeLogin2fa(e,t){var n;const r=await Ve.post("/auth/login/2fa",{twoFactorToken:e,token:t});return(n=r.data)!=null&&n.token&&r.data.refreshToken&&kf(r.data.token,r.data.refreshToken),r},async refresh(){var r;const e=Yee();if(!e)return{error:"No refresh token",status:401};const t=await Ve.post("/auth/refresh",{refreshToken:e});return(r=t.data)!=null&&r.token&&kf(t.data.token,e),t},async me(){return Ve.get("/auth/me")},async updateMe(e){return Ve.put("/auth/me",e)},async changePassword(e,t){return Ve.post("/auth/change-password",{currentPassword:e,newPassword:t})},async setup2fa(){return Ve.post("/auth/2fa/setup",{})},async verify2faSetup(e){return Ve.post("/auth/2fa/verify-setup",{token:e})},async disable2fa(e,t){return Ve.post("/auth/2fa/disable",{currentPassword:e,token:t??""})},logout(){f$()}},Lr={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 Ve.get(`/events${r?`?${r}`:""}`)},get(e){return Ve.get(`/events/${e}`)},create(e){return Ve.post("/events",e)},update(e,t){return Ve.put(`/events/${e}`,t)},remove(e){return Ve.delete(`/events/${e}`)},analytics(e){return Ve.get(`/events/${e}/analytics`)},duplicate(e){return Ve.post(`/events/${e}/duplicate`,{})},generateFromAi(e){return Ve.post("/events/generate-from-ai",e)},aiExtractPreview(e){return Ve.post("/events/ai-extract-preview",e)},emailerLinkTargets(e){return Ve.get(`/events/${e}/emailer-link-targets`)}},FO={leaderboard(e,t){const r=t!=null&&t>0?`?limit=${encodeURIComponent(String(t))}`:"";return Ve.get(`/events/${e}/leaderboard${r}`)},create(e,t){return Ve.post(`/events/${e}/reward-points`,{source:"manual",...t})}},ai={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 Ve.get(`/participants${r?`?${r}`:""}`)},listDistinctTags(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.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 Ve.get(`/participants/matching-ids${r?`?${r}`:""}`)},bulk(e){return Ve.post("/participants/bulk",e)},list(e,t){var o,a;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),(a=t==null?void 0:t.tag)!=null&&a.trim()&&r.set("tag",t.tag.trim());const n=r.toString();return Ve.get(`/events/${e}/participants${n?`?${n}`:""}`)},listDistinctTagsForEvent(e){return Ve.get(`/events/${e}/participants/tags`)},matchingIdsForEvent(e,t){var o,a;const r=new URLSearchParams;(o=t==null?void 0:t.q)!=null&&o.trim()&&r.set("q",t.q.trim()),(a=t==null?void 0:t.tag)!=null&&a.trim()&&r.set("tag",t.tag.trim()),t!=null&&t.status&&r.set("status",t.status),t!=null&&t.designation&&r.set("designation",t.designation);const n=r.toString();return Ve.get(`/events/${e}/participants/matching-ids${n?`?${n}`:""}`)},get(e){return Ve.get(`/participants/${e}`)},create(e,t){return Ve.post(`/events/${e}/participants`,t)},update(e,t){return Ve.put(`/participants/${e}`,t)},remove(e,t){const r=new URLSearchParams({event_id:t});return Ve.delete(`/participants/${e}?${r.toString()}`)},deleteOne(e){return Ve.delete(`/participants/${e}`)},checkIn(e,t){const r=new URLSearchParams({event_id:t});return Ve.post(`/participants/${e}/check-in?${r.toString()}`,{})},async downloadExport(e,t="participants-export.csv"){var s;const r=await wh(`/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 Ve.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 wh(`/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 Ve.post("/participants/import",e)}},Wc={list(e){return Ve.get(`/events/${e}/attendances`)},get(e,t){return Ve.get(`/events/${e}/attendances/${t}`)},create(e,t){return Ve.post(`/events/${e}/attendances`,t)},update(e,t,r){return Ve.put(`/events/${e}/attendances/${t}`,r)},remove(e,t){return Ve.delete(`/events/${e}/attendances/${t}`)},regenerateToken(e,t){return Ve.post(`/events/${e}/attendances/${t}/regenerate-token`,{})},listCheckIns(e,t,r){const n=new URLSearchParams;n.set("page",String((r==null?void 0:r.page)??1)),n.set("limit",String((r==null?void 0:r.limit)??20));const o=n.toString();return Ve.get(`/events/${e}/attendances/${t}/check-ins?${o}`)},searchParticipants(e,t,r){const n=new URLSearchParams;r!=null&&r.trim()&&n.set("q",r.trim());const o=n.toString();return Ve.get(`/events/${e}/attendances/${t}/search-participants${o?`?${o}`:""}`)},checkIn(e,t,r){return Ve.post(`/events/${e}/attendances/${t}/check-in`,{participantId:r})},async downloadExport(e,t,r="attendance-check-ins.csv"){var l;const n=await wh(`/events/${e}/attendances/${t}/export`,{method:"GET"});if(!n.ok){let c=n.statusText;try{const u=await n.json();c=((l=u==null?void 0:u.error)==null?void 0:l.message)||c}catch{}return{ok:!1,error:c}}const o=await n.blob(),a=URL.createObjectURL(o),s=document.createElement("a");return s.href=a,s.download=r,s.click(),URL.revokeObjectURL(a),{ok:!0}}};async function l5(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 c5(e){const t=cd.endsWith("/")?cd.slice(0,-1):cd,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}const u5={async getSession(e){const t=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}`));return l5(t)},async search(e,t){const r=new URLSearchParams;t!=null&&t.trim()&&r.set("q",t.trim());const n=r.toString(),o=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}/search${n?`?${n}`:""}`));return l5(o)},async checkIn(e,t){const r=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}/check-in`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({participantId:t})});return l5(r)}},qa={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.get(`/participant-lists${r?`?${r}`:""}`)},create(e){return Ve.post("/participant-lists",e)},get(e){return Ve.get(`/participant-lists/${e}`)},update(e,t){return Ve.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)),Ve.get(`/participant-lists/${e}/members?${r}`)},remove(e){return Ve.delete(`/participant-lists/${e}`)}},Vs={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 Ve.get(`/design-templates${r?`?${r}`:""}`)},get(e){return Ve.get(`/design-templates/${e}`)},create(e){return Ve.post("/design-templates",e)},update(e,t){return Ve.put(`/design-templates/${e}`,t)},remove(e){return Ve.delete(`/design-templates/${e}`)},duplicate(e){return Ve.post(`/design-templates/${e}/duplicate`,{})},useForEvent(e,t){return Ve.post(`/design-templates/${e}/use/${t}`,{})}},wx={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 Ve.get(`/badge-batches${r?`?${r}`:""}`)},get(e,t){const r=new URLSearchParams;t&&r.set("organization",t);const n=r.toString();return Ve.get(`/badge-batches/${e}${n?`?${n}`:""}`)},create(e){return Ve.post("/badge-batches",e)}},Ky={async list(e){var r;const t=await Ve.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 Ve.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 Ve.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 Ve.delete(`/events/${e}/tickets/${t}`);if(r.error)throw new Error(r.error)}};async function pf(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 hf(e){const t=cd.endsWith("/")?cd.slice(0,-1):cd,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}const gf={async getEventSummary(e){const t=await fetch(hf(`/public/events/${e}/summary`),{method:"GET"}),r=await pf(t);if(r.error)throw new Error(r.error);return r.data},async listTickets(e){var n;const t=await fetch(hf(`/public/events/${e}/tickets`),{method:"GET"}),r=await pf(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(hf(`/public/events/${e}/tickets/checkout-options`),{method:"GET"}),r=await pf(t);if(r.error)throw new Error(r.error);return r.data},async quote(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async manualQuote(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/manual-quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async checkout(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/checkout`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async verifyPayment(e,t){const r=await fetch(hf(`/public/events/${e}/payment/verify`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error)},async manualSubmit(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/manual-submit`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data}},d5={async get(e){var r;const t=await Ve.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 Ve.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 Ve.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}},z0={async list(e,t="pending_review"){var o;const r=t==="pending_review"?"":`?status=${encodeURIComponent(t)}`,n=await Ve.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 Ve.post(`/events/${e}/ticket-manual-orders/${t}/approve`,{});if(r.error)throw new Error(r.error)},async reject(e,t,r){const n=await Ve.post(`/events/${e}/ticket-manual-orders/${t}/reject`,{reason:r});if(n.error)throw new Error(n.error)}},Lf={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 Ve.get(`/speakers${r?`?${r}`:""}`)},get(e){return Ve.get(`/speakers/${e}`)},create(e){return Ve.post("/speakers",e)},update(e,t){return Ve.put(`/speakers/${e}`,t)},remove(e){return Ve.delete(`/speakers/${e}`)},byEvent(e){return Ve.get(`/events/${e}/speakers`)}};async function M0(e){if(e.error||!e.data)throw new Error(e.error??"Request failed");return e.data}const Mo={async list(e){var o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString(),n=await Ve.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 Ve.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 M0(await Ve.get(`/forms/${e}`))},async create(e){return M0(await Ve.post("/forms",e))},async createForEvent(e,t){return M0(await Ve.post(`/events/${e}/forms`,t))},async update(e,t){return M0(await Ve.put(`/forms/${e}`,t))},async remove(e){const t=await Ve.delete(`/forms/${e}`);if(t.error)throw new Error(t.error)},async getPublic(e){var o;const t=`${cd}/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 Ve.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 Ve.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 wh(`/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()}},Sx={list(){return Ve.get("/users")},create(e){return Ve.post("/users",e)},update(e,t){return Ve.put(`/users/${e}`,t)},remove(e){return Ve.delete(`/users/${e}`)}},dm={list(e){return Ve.get(`/events/${e}/tracks`)},create(e,t){return Ve.post(`/events/${e}/tracks`,t)},update(e,t){return Ve.put(`/tracks/${e}`,t)},remove(e){return Ve.delete(`/tracks/${e}`)}},ta={list(e){return Ve.get(`/events/${e}/sessions`)},create(e,t){return Ve.post(`/events/${e}/sessions`,t)},update(e,t){return Ve.put(`/sessions/${e}`,t)},remove(e){return Ve.delete(`/sessions/${e}`)}},wa={listStaff(e){return Ve.get(`/events/${e}/staff`)},listAvailableUsers(e){return Ve.get(`/events/${e}/staff/available-users`)},agendaTree(e){return Ve.get(`/events/${e}/agenda-tree`)},addStaff(e,t){return Ve.post(`/events/${e}/staff`,t)},updateStaff(e,t,r){return Ve.put(`/events/${e}/staff/${t}`,r)},removeStaff(e,t){return Ve.delete(`/events/${e}/staff/${t}`)},sendInvites(e,t){return Ve.post(`/events/${e}/staff/invites`,t)},cancelInvite(e,t){return Ve.delete(`/events/${e}/staff/invites/${t}`)},resendInvite(e,t){return Ve.post(`/events/${e}/staff/invites/${t}/resend`,{})},invitePreview(e){return Ve.get(`/event-invites/${e}`)},inviteAccept(e){return Ve.post("/event-invites/accept",e)}},Pi={listByEvent(e){return Ve.get(`/events/${e}/quiz-polls`)},listBySession(e){return Ve.get(`/sessions/${e}/quiz-polls`)},get(e){return Ve.get(`/quiz-polls/${e}`)},create(e,t){return Ve.post(`/events/${e}/quiz-polls`,t)},update(e,t){return Ve.put(`/quiz-polls/${e}`,t)},remove(e){return Ve.delete(`/quiz-polls/${e}`)},publish(e){return Ve.post(`/quiz-polls/${e}/publish`,{})},close(e){return Ve.post(`/quiz-polls/${e}/close`,{})},setLiveQuestion(e,t){return Ve.post(`/quiz-polls/${e}/live-question`,{questionId:t})},setShowCorrect(e,t){return Ve.post(`/quiz-polls/${e}/show-correct`,{show:t})},ensurePresentationToken(e){return Ve.post(`/quiz-polls/${e}/presentation-token`,{})}},Gee=["home","agenda","speakers","registration","sponsors","custom"],Kee=["header","banner","contact_form","agenda","register_links","speakers","footer","sponsors","cta","custom_html","countdown","gallery","about","venue","faq","tickets"],Yc={list(e){return Ve.get(`/events/${e}/pages`)},get(e){return Ve.get(`/pages/${e}`)},create(e,t){return Ve.post(`/events/${e}/pages`,t)},update(e,t){return Ve.put(`/pages/${e}`,t)},remove(e){return Ve.delete(`/pages/${e}`)},publish(e){return Ve.post(`/pages/${e}/publish`,{})},exportHtml(e,t){const r=t?`?registrationUrl=${encodeURIComponent(t)}`:"";return Ve.get(`/pages/${e}/export-html${r}`)}},Xc={get(e){return Ve.get(`/events/${e}/website-settings`)},update(e,t){return Ve.put(`/events/${e}/website-settings`,t)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Ve.get(`/events/${e}/website-settings/check-folder?${n.toString()}`)},publishMicrosite(e,t){return Ve.post(`/events/${e}/website/publish-microsite`,t??{})},micrositePreviewHtml(e,t){const r=t?`?micrositeId=${encodeURIComponent(t)}`:"";return Ve.get(`/events/${e}/website-settings/microsite-preview-html${r}`)}},ha={listForOrganization(e){return Ve.get(`/event-microsites?organization=${encodeURIComponent(e)}`)},list(e){return Ve.get(`/events/${e}/microsites`)},get(e,t){return Ve.get(`/events/${e}/microsites/${t}`)},create(e,t){return Ve.post(`/events/${e}/microsites`,t)},update(e,t,r){return Ve.put(`/events/${e}/microsites/${t}`,r)},delete(e,t){return Ve.delete(`/events/${e}/microsites/${t}`)},publish(e,t,r){return Ve.post(`/events/${e}/microsites/${t}/publish`,r??{})},previewHtml(e,t){return Ve.get(`/events/${e}/microsites/${t}/preview-html`)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Ve.get(`/events/${e}/microsites/check-folder?${n.toString()}`)}};async function h$(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 Ve.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 Sa(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 wh("/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 r2={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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.delete(`/content-collections/${e}`);if(t.error)throw new Error(t.error)}},cs={async get(e){const t=e!=null&&e.cacheBust?`?_=${encodeURIComponent(String(Date.now()))}`:"",r=await Ve.get(`/organization${t}`);if(r.error)throw new Error(r.error);return r.data??null},async update(e){const t=await Ve.put("/organization",e);if(t.error||t.data==null)throw new Error(t.error??"Update failed");return t.data},getEmailSettings(){return Ve.get("/organization/email-settings")},updateEmailSettings(e){return Ve.put("/organization/email-settings",e)},testEmailSettings(e){return Ve.post("/organization/email-settings/test",{to:e})},getWhatsAppSettings(){return Ve.get("/organization/whatsapp-settings")},updateWhatsAppSettings(e){return Ve.put("/organization/whatsapp-settings",e)}},em={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 Ve.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 Ve.get(`/whatsapp-templates/${e}${n?`?${n}`:""}`)},create(e){return Ve.post("/whatsapp-templates",e)},sync(e){return Ve.post(`/whatsapp-templates/${e}/sync`,{})},remove(e){return Ve.delete(`/whatsapp-templates/${e}`)}},Ls={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.get(`/concierge-bots${r?`?${r}`:""}`)},get(e){return Ve.get(`/concierge-bots/${e}`)},getByEvent(e){return Ve.get(`/events/${e}/concierge-bot`)},create(e){return Ve.post("/concierge-bots",e)},update(e,t){return Ve.put(`/concierge-bots/${e}`,t)},remove(e){return Ve.delete(`/concierge-bots/${e}`)},listSources(e){return Ve.get(`/concierge-bots/${e}/sources`)},createSource(e,t){return Ve.post(`/concierge-bots/${e}/sources`,t)},deleteSource(e,t){return Ve.delete(`/concierge-bots/${e}/sources/${t}`)},syncSource(e,t){return Ve.post(`/concierge-bots/${e}/sources/${t}/sync`,{})},listChunks(e,t,r=!0){return Ve.get(`/concierge-bots/${e}/sources/${t}/chunks?staging=${r?"true":"false"}`)},patchChunk(e,t,r){return Ve.patch(`/concierge-bots/${e}/chunks/${t}`,{rawText:r})},deleteChunk(e,t){return Ve.delete(`/concierge-bots/${e}/chunks/${t}`)},approveSource(e,t){return Ve.post(`/concierge-bots/${e}/sources/${t}/approve`,{})},clearKnowledge(e){return Ve.post(`/concierge-bots/${e}/knowledge/clear`,{})},syncEventKnowledge(e){return Ve.post(`/concierge-bots/${e}/knowledge/sync-event`,{})}},fo={listByOrg(e){const t=new URLSearchParams;e!=null&&e.channel&&t.set("channel",e.channel);const r=t.toString();return Ve.get(`/campaigns${r?`?${r}`:""}`)},listForEvent(e){return Ve.get(`/events/${e}/campaigns`)},create(e,t){return Ve.post(`/events/${e}/campaigns`,t)},get(e){return Ve.get(`/campaigns/${e}`)},update(e,t){return Ve.put(`/campaigns/${e}`,t)},remove(e){return Ve.delete(`/campaigns/${e}`)},send(e,t={}){return Ve.post(`/campaigns/${e}/send`,t)},schedule(e,t){return Ve.post(`/campaigns/${e}/schedule`,{scheduledFor:t})},cancel(e){return Ve.post(`/campaigns/${e}/cancel`,{})},stop(e){return Ve.post(`/campaigns/${e}/stop`,{})},analytics(e){return Ve.get(`/campaigns/${e}/analytics`)},preview(e,t){return Ve.post(`/campaigns/${e}/preview`,t||{})}};function cT(){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 ed={async catalog(){const e=await Ve.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 Ve.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 Ve.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 Ve.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 Ve.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 wh(`/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)}},nd={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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.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 Ve.delete(`/platform-admin/plans/${t}`);if(r.error||!r.data)throw new Error(r.error??"Failed to delete plan");return r.data}},zO={async create(e){const t=await Ve.post("/admin-requests",e);if(t.error||!t.data)throw new Error(t.error??"Request failed");return t.data}},Hu={getPlatformConfig(){return Ve.get("/platform/payment-config")},updatePlatformConfig(e){return Ve.put("/platform/payment-config",e)},getOrgProfile(){return Ve.get("/organization/payment-profile")},updateOrgProfile(e){return Ve.put("/organization/payment-profile",e)},addGateway(e){return Ve.post("/organization/payment-profile/gateways",e)},patchGateway(e,t){return Ve.patch(`/organization/payment-profile/gateways/${e}`,t)},deleteGateway(e){return Ve.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 Ve.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 wh(`/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 g$(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 Nn(e){if(!(!(e!=null&&e.organization)||typeof e.organization!="object"))return e.organization._id}const A3="eventbuzz_user";function Qee(){try{const e=localStorage.getItem(A3);return e?JSON.parse(e):null}catch{return null}}function xl(e){try{e?localStorage.setItem(A3,JSON.stringify(e)):localStorage.removeItem(A3)}catch{}}const m$=S.createContext(null);function Xee({children:e}){const[t,r]=S.useState(()=>({user:Qee(),loading:!0,checked:!1})),n=S.useCallback(async()=>{try{const f=await Ma.me();f.data?(xl(f.data),r(h=>({...h,user:f.data,checked:!0}))):(xl(null),r(h=>({...h,user:null,checked:!0})))}catch{xl(null),r(f=>({...f,user:null,checked:!0}))}},[]);S.useEffect(()=>{let f=!1;return(async()=>{try{const h=await Ma.me();if(f)return;h.data?(xl(h.data),r({user:h.data,loading:!1,checked:!0})):(xl(null),r({user:null,loading:!1,checked:!0}))}catch{f||(xl(null),r({user:null,loading:!1,checked:!0}))}})(),()=>{f=!0}},[]);const o=S.useCallback(async(f,h)=>{const p=await Ma.login(f,h);if(p.error)return{error:p.error};const v=p.data;return v&&"requiresTwoFactor"in v&&v.requiresTwoFactor&&v.twoFactorToken?{requiresTwoFactor:!0,twoFactorToken:v.twoFactorToken,email:"email"in v?v.email:void 0}:v&&"user"in v&&v.user?(xl(v.user),r(m=>({...m,user:v.user})),{success:!0}):{error:"Login failed"}},[]),a=S.useCallback(async f=>{let h=await Ma.googleLogin(f);if(h.error&&/register first|not registered/i.test(h.error)&&(h=await Ma.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?(xl(p.user),r(v=>({...v,user:p.user})),{success:!0}):{error:"Google sign-in failed"}},[]),s=S.useCallback(async(f,h)=>{var v;const p=await Ma.completeLogin2fa(f,h.replace(/\s/g,""));return p.error?{error:p.error}:(v=p.data)!=null&&v.user?(xl(p.data.user),r(m=>({...m,user:p.data.user})),{}):{error:"Verification failed"}},[]),l=S.useCallback(async f=>{const h=await Ma.register(f);if(h.data){const p=h.data.user;return xl(p),r(v=>({...v,user:p})),{}}return{error:h.error||"Registration failed"}},[]),c=S.useCallback(async f=>{const h=await Ma.googleRegister(f);if(h.data){const p=h.data.user;return xl(p),r(v=>({...v,user:p})),{}}return{error:h.error||"Registration failed"}},[]),u=S.useCallback(()=>{Ma.logout(),xl(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(m$.Provider,{value:d,children:e})}function Mr(){const e=S.useContext(m$);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 Zee=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),MO=e=>{const t=Jee(e);return t.charAt(0).toUpperCase()+t.slice(1)},v$=(...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 ete={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 tte=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:a,iconNode:s,...l},c)=>S.createElement("svg",{ref:c,...ete,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:v$("lucide",o),...l},[...s.map(([u,d])=>S.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 Nt=(e,t)=>{const r=S.forwardRef(({className:n,...o},a)=>S.createElement(tte,{ref:a,iconNode:t,className:v$(`lucide-${Zee(MO(e))}`,`lucide-${e}`,n),...o}));return r.displayName=MO(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 rte=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],nte=Nt("align-left",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 ite=[["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"}]],ote=Nt("archive",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 ate=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],uT=Nt("arrow-left",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 ste=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],dT=Nt("arrow-right",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 lte=[["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"}]],cte=Nt("arrow-up-narrow-wide",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 ute=[["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"}]],dte=Nt("award",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 fte=[["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"}]],pte=Nt("bell-off",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:"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"}]],fT=Nt("bell",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:"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"}]],n2=Nt("book-open",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:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],DO=Nt("bookmark",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:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],yte=Nt("bot",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 xte=[["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"}]],_b=Nt("building-2",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 bte=[["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"}]],y$=Nt("calendar-days",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 wte=[["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"}]],Vi=Nt("calendar",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=[["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"}]],pT=Nt("chart-column",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:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],x$=Nt("chart-line",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=[["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"}]],_te=Nt("chart-no-axes-column-increasing",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 Cte=[["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"}]],Ad=Nt("chart-no-axes-column",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=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bi=Nt("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],go=Nt("chevron-down",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:"m15 18-6-6 6-6",key:"1wnfg3"}]],vd=Nt("chevron-left",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:"m9 18 6-6-6-6",key:"mthhwq"}]],ka=Nt("chevron-right",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 Ite=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qf=Nt("chevron-up",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=[["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"}]],Wh=Nt("circle-alert",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:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Rte=Nt("circle-check-big",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 Lte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yv=Nt("circle-check",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=[["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"}]],tS=Nt("circle-help",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 zte=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],hT=Nt("clipboard-check",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 Mte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],rS=Nt("clock",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 Dte=[["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"}]],Js=Nt("copy",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 Bte=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],xv=Nt("credit-card",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 Wte=[["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"}]],ja=Nt("download",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 qte=[["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"}]],$te=Nt("ellipsis",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 Ute=[["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"}]],bv=Nt("external-link",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:"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"}]],gT=Nt("eye-off",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=[["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"}]],qh=Nt("eye",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:"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"}]],Gte=Nt("file-image",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 Kte=[["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"}]],Sh=Nt("file-text",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 Qte=[["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"}]],mT=Nt("file",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=[["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"}]],Zte=Nt("film",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 Jte=[["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"}]],BO=Nt("folder-open",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 ere=[["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"}]],tre=Nt("funnel",ere);/** - * @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=[["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"}]],Wf=Nt("globe",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=[["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"}]],wv=Nt("grip-vertical",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=[["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"}]],ore=Nt("hash",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:"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"}]],vT=Nt("house",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=[["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"}]],jx=Nt("image",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:"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"}]],nS=Nt("layers",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=[["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"}]],ure=Nt("layout-dashboard",cre);/** - * @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 dre=[["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"}]],Cb=Nt("layout-grid",dre);/** - * @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 fre=[["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"}]],pre=Nt("layout-list",fre);/** - * @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 hre=[["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"}]],i2=Nt("link-2",hre);/** - * @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 gre=[["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"}]],mre=Nt("linkedin",gre);/** - * @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 vre=[["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"}]],Eb=Nt("list",vre);/** - * @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 yre=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kx=Nt("loader-circle",yre);/** - * @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 xre=[["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"}]],bre=Nt("lock",xre);/** - * @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 wre=[["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"}]],Sre=Nt("log-out",wre);/** - * @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 jre=[["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"}]],b$=Nt("mail-check",jre);/** - * @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 kre=[["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"}]],Xf=Nt("mail",kre);/** - * @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 _re=[["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"}]],Ab=Nt("map-pin",_re);/** - * @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=[["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"}]],Ere=Nt("menu",Cre);/** - * @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:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],$h=Nt("message-circle",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 Tre=[["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"}]],dd=Nt("message-square",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 Pre=[["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"}]],iS=Nt("mic-vocal",Pre);/** - * @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:"M5 12h14",key:"1ays0h"}]],oS=Nt("minus",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 Ore=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Nre=Nt("monitor",Ore);/** - * @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:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],WO=Nt("moon",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 Lre=[["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"}]],Fre=Nt("mouse-pointer",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 zre=[["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"}]],tm=Nt("palette",zre);/** - * @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 Mre=[["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"}]],w$=Nt("panels-top-left",Mre);/** - * @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 Dre=[["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"}]],wi=Nt("pencil",Dre);/** - * @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 Bre=[["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"}]],aS=Nt("phone",Bre);/** - * @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 Wre=[["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"}]],S$=Nt("plug",Wre);/** - * @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 qre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gr=Nt("plus",qre);/** - * @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 $re=[["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"}]],Zf=Nt("qr-code",$re);/** - * @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 Ure=[["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"}]],Hre=Nt("radio",Ure);/** - * @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 Vre=[["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"}]],_x=Nt("refresh-cw",Vre);/** - * @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 Yre=[["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"}]],j$=Nt("rocket",Yre);/** - * @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 Gre=[["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"}]],Kre=Nt("rotate-ccw",Gre);/** - * @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 Qre=[["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"}]],sS=Nt("save",Qre);/** - * @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 Xre=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],pi=Nt("search",Xre);/** - * @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 Zre=[["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"}]],k$=Nt("send",Zre);/** - * @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 Jre=[["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"}]],hc=Nt("settings",Jre);/** - * @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 ene=[["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"}]],tne=Nt("shield-check",ene);/** - * @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 rne=[["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"}]],fd=Nt("shield",rne);/** - * @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 nne=[["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"}]],ine=Nt("sparkles",nne);/** - * @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 one=[["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"}]],_$=Nt("square-check-big",one);/** - * @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 ane=[["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"}]],T3=Nt("square-pen",ane);/** - * @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 sne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],C$=Nt("square",sne);/** - * @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 lne=[["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"}]],E$=Nt("star",lne);/** - * @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 cne=[["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"}]],qO=Nt("sun",cne);/** - * @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 une=[["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"}]],Cx=Nt("tag",une);/** - * @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 dne=[["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"}]],A$=Nt("ticket",dne);/** - * @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 fne=[["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"}]],Xr=Nt("trash-2",fne);/** - * @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 pne=[["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"}]],T$=Nt("trending-up",pne);/** - * @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 hne=[["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"}]],nu=Nt("trophy",hne);/** - * @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 gne=[["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"}]],mne=Nt("twitter",gne);/** - * @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 vne=[["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"}]],Fl=Nt("upload",vne);/** - * @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 yne=[["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"}]],lS=Nt("user-check",yne);/** - * @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 xne=[["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"}]],yT=Nt("user-plus",xne);/** - * @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 bne=[["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"}]],wne=Nt("user-x",bne);/** - * @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 Sne=[["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"}]],Om=Nt("user",Sne);/** - * @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 jne=[["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"}]],Ri=Nt("users",jne);/** - * @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 kne=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Gt=Nt("x",kne);/** - * @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 _ne=[["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"}]],cS=Nt("zap",_ne);function Tb({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(Wh,{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 hs(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 $O(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function P$(...e){return t=>{let r=!1;const n=e.map(o=>{const a=$O(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o{const{children:s,...l}=a,c=S.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:s})};n.displayName=e+"Provider";function o(a){const s=S.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 uS(e,t=[]){let r=[];function n(a,s){const l=S.createContext(s),c=r.length;r=[...r,s];const u=f=>{var x;const{scope:h,children:p,...v}=f,m=((x=h==null?void 0:h[e])==null?void 0:x[c])||l,b=S.useMemo(()=>v,Object.values(v));return i.jsx(m.Provider,{value:b,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,v=S.useContext(p);if(v)return v;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=>S.createContext(s));return function(l){const c=(l==null?void 0:l[e])||a;return S.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[n,Ene(o,...t)]}function Ene(...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 S.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var jh=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},Ane=Vq.useId||(()=>{}),Tne=0;function F1(e){const[t,r]=S.useState(Ane());return jh(()=>{r(n=>n??String(Tne++))},[e]),e||(t?`radix-${t}`:"")}function qf(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function xT({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=Pne({defaultProp:t,onChange:r}),a=e!==void 0,s=a?e:n,l=qf(r),c=S.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 Pne({defaultProp:e,onChange:t}){const r=S.useState(e),[n]=r,o=S.useRef(n),a=qf(t);return S.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}var dS=S.forwardRef((e,t)=>{const{children:r,...n}=e,o=S.Children.toArray(r),a=o.find(One);if(a){const s=a.props.children,l=o.map(c=>c===a?S.Children.count(s)>1?S.Children.only(null):S.isValidElement(s)?s.props.children:null:c);return i.jsx(P3,{...n,ref:t,children:S.isValidElement(s)?S.cloneElement(s,void 0,l):null})}return i.jsx(P3,{...n,ref:t,children:r})});dS.displayName="Slot";var P3=S.forwardRef((e,t)=>{const{children:r,...n}=e;if(S.isValidElement(r)){const o=Rne(r),a=Nne(n,r.props);return r.type!==S.Fragment&&(a.ref=t?P$(t,o):o),S.cloneElement(r,a)}return S.Children.count(r)>1?S.Children.only(null):null});P3.displayName="SlotClone";var Ine=({children:e})=>i.jsx(i.Fragment,{children:e});function One(e){return S.isValidElement(e)&&e.type===Ine}function Nne(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 Rne(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 Lne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_a=Lne.reduce((e,t)=>{const r=S.forwardRef((n,o)=>{const{asChild:a,...s}=n,l=a?dS: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 Fne(e,t){e&&iT.flushSync(()=>e.dispatchEvent(t))}function zne(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e);S.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 Mne="DismissableLayer",I3="dismissableLayer.update",Dne="dismissableLayer.pointerDownOutside",Bne="dismissableLayer.focusOutside",UO,I$=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),bT=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=e,u=S.useContext(I$),[d,f]=S.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=S.useState({}),v=zl(t,A=>f(A)),m=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=m.indexOf(b),w=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,j=w>=x,_=$ne(A=>{const P=A.target,N=[...u.branches].some(O=>O.contains(P));!j||N||(o==null||o(A),s==null||s(A),A.defaultPrevented||l==null||l())},h),T=Une(A=>{const P=A.target;[...u.branches].some(O=>O.contains(P))||(a==null||a(A),s==null||s(A),A.defaultPrevented||l==null||l())},h);return zne(A=>{w===u.layers.size-1&&(n==null||n(A),!A.defaultPrevented&&l&&(A.preventDefault(),l()))},h),S.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(UO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),HO(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=UO)}},[d,h,r,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),HO())},[d,u]),S.useEffect(()=>{const A=()=>p({});return document.addEventListener(I3,A),()=>document.removeEventListener(I3,A)},[]),i.jsx(_a.div,{...c,ref:v,style:{pointerEvents:k?j?"auto":"none":void 0,...e.style},onFocusCapture:hs(e.onFocusCapture,T.onFocusCapture),onBlurCapture:hs(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:hs(e.onPointerDownCapture,_.onPointerDownCapture)})});bT.displayName=Mne;var Wne="DismissableLayerBranch",qne=S.forwardRef((e,t)=>{const r=S.useContext(I$),n=S.useRef(null),o=zl(t,n);return S.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),i.jsx(_a.div,{...e,ref:o})});qne.displayName=Wne;function $ne(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e),n=S.useRef(!1),o=S.useRef(()=>{});return S.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){O$(Dne,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 Une(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e),n=S.useRef(!1);return S.useEffect(()=>{const o=a=>{a.target&&!n.current&&O$(Bne,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 HO(){const e=new CustomEvent(I3);document.dispatchEvent(e)}function O$(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?Fne(o,a):o.dispatchEvent(a)}var f5="focusScope.autoFocusOnMount",p5="focusScope.autoFocusOnUnmount",VO={bubbles:!1,cancelable:!0},Hne="FocusScope",wT=S.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[l,c]=S.useState(null),u=qf(o),d=qf(a),f=S.useRef(null),h=zl(t,m=>c(m)),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(n){let m=function(k){if(p.paused||!l)return;const j=k.target;l.contains(j)?f.current=j:jf(f.current,{select:!0})},b=function(k){if(p.paused||!l)return;const j=k.relatedTarget;j!==null&&(l.contains(j)||jf(f.current,{select:!0}))},x=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&jf(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const w=new MutationObserver(x);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),w.disconnect()}}},[n,l,p.paused]),S.useEffect(()=>{if(l){GO.add(p);const m=document.activeElement;if(!l.contains(m)){const x=new CustomEvent(f5,VO);l.addEventListener(f5,u),l.dispatchEvent(x),x.defaultPrevented||(Vne(Xne(N$(l)),{select:!0}),document.activeElement===m&&jf(l))}return()=>{l.removeEventListener(f5,u),setTimeout(()=>{const x=new CustomEvent(p5,VO);l.addEventListener(p5,d),l.dispatchEvent(x),x.defaultPrevented||jf(m??document.body,{select:!0}),l.removeEventListener(p5,d),GO.remove(p)},0)}}},[l,u,d,p]);const v=S.useCallback(m=>{if(!r&&!n||p.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,x=document.activeElement;if(b&&x){const w=m.currentTarget,[k,j]=Yne(w);k&&j?!m.shiftKey&&x===j?(m.preventDefault(),r&&jf(k,{select:!0})):m.shiftKey&&x===k&&(m.preventDefault(),r&&jf(j,{select:!0})):x===w&&m.preventDefault()}},[r,n,p.paused]);return i.jsx(_a.div,{tabIndex:-1,...s,ref:h,onKeyDown:v})});wT.displayName=Hne;function Vne(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(jf(n,{select:t}),document.activeElement!==r)return}function Yne(e){const t=N$(e),r=YO(t,e),n=YO(t.reverse(),e);return[r,n]}function N$(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 YO(e,t){for(const r of e)if(!Gne(r,{upTo:t}))return r}function Gne(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 Kne(e){return e instanceof HTMLInputElement&&"select"in e}function jf(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Kne(e)&&t&&e.select()}}var GO=Qne();function Qne(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=KO(e,t),e.unshift(t)},remove(t){var r;e=KO(e,t),(r=e[0])==null||r.resume()}}}function KO(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Xne(e){return e.filter(t=>t.tagName!=="A")}var Zne="Portal",ST=S.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[o,a]=S.useState(!1);jh(()=>a(!0),[]);const s=r||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?LJ.createPortal(i.jsx(_a.div,{...n,ref:t}),s):null});ST.displayName=Zne;function Jne(e,t){return S.useReducer((r,n)=>t[r][n]??r,e)}var Sv=e=>{const{present:t,children:r}=e,n=eie(t),o=typeof r=="function"?r({present:n.isPresent}):S.Children.only(r),a=zl(n.ref,tie(o));return typeof r=="function"||n.isPresent?S.cloneElement(o,{ref:a}):null};Sv.displayName="Presence";function eie(e){const[t,r]=S.useState(),n=S.useRef({}),o=S.useRef(e),a=S.useRef("none"),s=e?"mounted":"unmounted",[l,c]=Jne(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const u=D0(n.current);a.current=l==="mounted"?u:"none"},[l]),jh(()=>{const u=n.current,d=o.current;if(d!==e){const h=a.current,p=D0(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]),jh(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=D0(n.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(a.current=D0(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:S.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function D0(e){return(e==null?void 0:e.animationName)||"none"}function tie(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 h5=0;function R$(){S.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??QO()),document.body.insertAdjacentElement("beforeend",e[1]??QO()),h5++,()=>{h5===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),h5--}},[])}function QO(){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 Zc=function(){return Zc=Object.assign||function(t){for(var r,n=1,o=arguments.length;n"u")return yie;var t=xie(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])}},wie=M$(),fm="data-scroll-locked",Sie=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(nie,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(l,"px ").concat(n,`; - } - body[`).concat(fm,`] { - 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(z1,` { - right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(M1,` { - margin-right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(z1," .").concat(z1,` { - right: 0 `).concat(n,`; - } - - .`).concat(M1," .").concat(M1,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(fm,`] { - `).concat(iie,": ").concat(l,`px; - } -`)},ZO=function(){var e=parseInt(document.body.getAttribute(fm)||"0",10);return isFinite(e)?e:0},jie=function(){S.useEffect(function(){return document.body.setAttribute(fm,(ZO()+1).toString()),function(){var e=ZO()-1;e<=0?document.body.removeAttribute(fm):document.body.setAttribute(fm,e.toString())}},[])},kie=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;jie();var a=S.useMemo(function(){return bie(o)},[o]);return S.createElement(wie,{styles:Sie(a,!t,o,r?"":"!important")})},O3=!1;if(typeof window<"u")try{var B0=Object.defineProperty({},"passive",{get:function(){return O3=!0,!0}});window.addEventListener("test",B0,B0),window.removeEventListener("test",B0,B0)}catch{O3=!1}var Ig=O3?{passive:!1}:!1,_ie=function(e){return e.tagName==="TEXTAREA"},D$=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!_ie(e)&&r[t]==="visible")},Cie=function(e){return D$(e,"overflowY")},Eie=function(e){return D$(e,"overflowX")},JO=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=B$(e,n);if(o){var a=W$(e,n),s=a[1],l=a[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Aie=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Tie=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},B$=function(e,t){return e==="v"?Cie(t):Eie(t)},W$=function(e,t){return e==="v"?Aie(t):Tie(t)},Pie=function(e,t){return e==="h"&&t==="rtl"?-1:1},Iie=function(e,t,r,n,o){var a=Pie(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=W$(e,l),v=p[0],m=p[1],b=p[2],x=m-b-a*v;(v||x)&&B$(e,l)&&(f+=x,h+=v);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},W0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eN=function(e){return[e.deltaX,e.deltaY]},tN=function(e){return e&&"current"in e?e.current:e},Oie=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Nie=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Rie=0,Og=[];function Lie(e){var t=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),o=S.useState(Rie++)[0],a=S.useState(M$)[0],s=S.useRef(e);S.useEffect(function(){s.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=rie([e.lockRef.current],(e.shards||[]).map(tN),!0).filter(Boolean);return m.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=S.useCallback(function(m,b){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var x=W0(m),w=r.current,k="deltaX"in m?m.deltaX:w[0]-x[0],j="deltaY"in m?m.deltaY:w[1]-x[1],_,T=m.target,A=Math.abs(k)>Math.abs(j)?"h":"v";if("touches"in m&&A==="h"&&T.type==="range")return!1;var P=window.getSelection(),N=P&&P.anchorNode,O=N?N===T||N.contains(T):!1;if(O)return!1;var C=JO(A,T);if(!C)return!0;if(C?_=A:(_=A==="v"?"h":"v",C=JO(A,T)),!C)return!1;if(!n.current&&"changedTouches"in m&&(k||j)&&(n.current=_),!_)return!0;var I=n.current||_;return Iie(I,b,m,I==="h"?k:j)},[]),c=S.useCallback(function(m){var b=m;if(!(!Og.length||Og[Og.length-1]!==a)){var x="deltaY"in b?eN(b):W0(b),w=t.current.filter(function(_){return _.name===b.type&&(_.target===b.target||b.target===_.shadowParent)&&Oie(_.delta,x)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var k=(s.current.shards||[]).map(tN).filter(Boolean).filter(function(_){return _.contains(b.target)}),j=k.length>0?l(b,k[0]):!s.current.noIsolation;j&&b.cancelable&&b.preventDefault()}}},[]),u=S.useCallback(function(m,b,x,w){var k={name:m,delta:b,target:x,should:w,shadowParent:Fie(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(j){return j!==k})},1)},[]),d=S.useCallback(function(m){r.current=W0(m),n.current=void 0},[]),f=S.useCallback(function(m){u(m.type,eN(m),m.target,l(m,e.lockRef.current))},[]),h=S.useCallback(function(m){u(m.type,W0(m),m.target,l(m,e.lockRef.current))},[]);S.useEffect(function(){return Og.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Ig),document.addEventListener("touchmove",c,Ig),document.addEventListener("touchstart",d,Ig),function(){Og=Og.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,Ig),document.removeEventListener("touchmove",c,Ig),document.removeEventListener("touchstart",d,Ig)}},[]);var p=e.removeScrollBar,v=e.inert;return S.createElement(S.Fragment,null,v?S.createElement(a,{styles:Nie(o)}):null,p?S.createElement(kie,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Fie(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zie=die(z$,Lie);var jT=S.forwardRef(function(e,t){return S.createElement(fS,Zc({},e,{ref:t,sideCar:zie}))});jT.classNames=fS.classNames;var Mie=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ng=new WeakMap,q0=new WeakMap,$0={},y5=0,q$=function(e){return e&&(e.host||q$(e.parentNode))},Die=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=q$(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})},Bie=function(e,t,r,n){var o=Die(t,Array.isArray(e)?e:[e]);$0[r]||($0[r]=new WeakMap);var a=$0[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),v=p!==null&&p!=="false",m=(Ng.get(h)||0)+1,b=(a.get(h)||0)+1;Ng.set(h,m),a.set(h,b),s.push(h),m===1&&v&&q0.set(h,!0),b===1&&h.setAttribute(r,"true"),v||h.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return d(t),l.clear(),y5++,function(){s.forEach(function(f){var h=Ng.get(f)-1,p=a.get(f)-1;Ng.set(f,h),a.set(f,p),h||(q0.has(f)||f.removeAttribute(n),q0.delete(f)),p||f.removeAttribute(r)}),y5--,y5||(Ng=new WeakMap,Ng=new WeakMap,q0=new WeakMap,$0={})}},$$=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=Mie(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),Bie(n,o,r,"aria-hidden")):function(){return null}},kT="Dialog",[U$]=uS(kT),[Wie,bc]=U$(kT),H$=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=S.useRef(null),c=S.useRef(null),[u=!1,d]=xT({prop:n,defaultProp:o,onChange:a});return i.jsx(Wie,{scope:t,triggerRef:l,contentRef:c,contentId:F1(),titleId:F1(),descriptionId:F1(),open:u,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(f=>!f),[d]),modal:s,children:r})};H$.displayName=kT;var V$="DialogTrigger",qie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(V$,r),a=zl(t,o.triggerRef);return i.jsx(_a.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ET(o.open),...n,ref:a,onClick:hs(e.onClick,o.onOpenToggle)})});qie.displayName=V$;var _T="DialogPortal",[$ie,Y$]=U$(_T,{forceMount:void 0}),G$=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:o}=e,a=bc(_T,t);return i.jsx($ie,{scope:t,forceMount:r,children:S.Children.map(n,s=>i.jsx(Sv,{present:r||a.open,children:i.jsx(ST,{asChild:!0,container:o,children:s})}))})};G$.displayName=_T;var o2="DialogOverlay",K$=S.forwardRef((e,t)=>{const r=Y$(o2,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=bc(o2,e.__scopeDialog);return a.modal?i.jsx(Sv,{present:n||a.open,children:i.jsx(Uie,{...o,ref:t})}):null});K$.displayName=o2;var Uie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(o2,r);return i.jsx(jT,{as:dS,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(_a.div,{"data-state":ET(o.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),kh="DialogContent",Q$=S.forwardRef((e,t)=>{const r=Y$(kh,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=bc(kh,e.__scopeDialog);return i.jsx(Sv,{present:n||a.open,children:a.modal?i.jsx(Hie,{...o,ref:t}):i.jsx(Vie,{...o,ref:t})})});Q$.displayName=kh;var Hie=S.forwardRef((e,t)=>{const r=bc(kh,e.__scopeDialog),n=S.useRef(null),o=zl(t,r.contentRef,n);return S.useEffect(()=>{const a=n.current;if(a)return $$(a)},[]),i.jsx(X$,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hs(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:hs(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&a.preventDefault()}),onFocusOutside:hs(e.onFocusOutside,a=>a.preventDefault())})}),Vie=S.forwardRef((e,t)=>{const r=bc(kh,e.__scopeDialog),n=S.useRef(!1),o=S.useRef(!1);return i.jsx(X$,{...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()}})}),X$=S.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=e,l=bc(kh,r),c=S.useRef(null),u=zl(t,c);return R$(),i.jsxs(i.Fragment,{children:[i.jsx(wT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(bT,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ET(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Gie,{titleId:l.titleId}),i.jsx(Qie,{contentRef:c,descriptionId:l.descriptionId})]})]})}),CT="DialogTitle",Z$=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(CT,r);return i.jsx(_a.h2,{id:o.titleId,...n,ref:t})});Z$.displayName=CT;var J$="DialogDescription",Yie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(J$,r);return i.jsx(_a.p,{id:o.descriptionId,...n,ref:t})});Yie.displayName=J$;var eU="DialogClose",tU=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(eU,r);return i.jsx(_a.button,{type:"button",...n,ref:t,onClick:hs(e.onClick,()=>o.onOpenChange(!1))})});tU.displayName=eU;function ET(e){return e?"open":"closed"}var rU="DialogTitleWarning",[bFe,nU]=Cne(rU,{contentName:kh,titleName:CT,docsSlug:"dialog"}),Gie=({titleId:e})=>{const t=nU(rU),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 S.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Kie="DialogDescriptionWarning",Qie=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nU(Kie).contentName}}.`;return S.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},iU=H$,oU=G$,aU=K$,sU=Q$,lU=Z$,cU=tU;function uU(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=Jie(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{const l=s.split(AT);return l[0]===""&&l.length!==1&&l.shift(),dU(l,t)||Zie(s)},getConflictingClassGroupIds:(s,l)=>{const c=r[s]||[];return l&&n[s]?[...c,...n[s]]:c}}},dU=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?dU(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(AT);return(s=t.validators.find(({validator:l})=>l(a)))==null?void 0:s.classGroupId},rN=/^\[(.+)\]$/,Zie=e=>{if(rN.test(e)){const t=rN.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Jie=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const o in r)N3(r[o],n,o,t);return n},N3=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:nN(t,o);a.classGroupId=r;return}if(typeof o=="function"){if(eoe(o)){N3(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([a,s])=>{N3(s,nN(t,a),r,n)})})},nN=(e,t)=>{let r=e;return t.split(AT).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},eoe=e=>e.isThemeGetter,toe=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)}}},R3="!",L3=":",roe=L3.length,noe=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let s=0,l=0,c=0,u;for(let v=0;vc?u-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const o=t+L3,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},ioe=e=>e.endsWith(R3)?e.substring(0,e.length-1):e.startsWith(R3)?e.substring(1):e,ooe=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}},aoe=e=>({cache:toe(e.cacheSize),parseClassName:noe(e),sortModifiers:ooe(e),...Xie(e)}),soe=/\s+/,loe=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,s=[],l=e.trim().split(soe);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:m}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let b=!!m,x=n(b?v.substring(0,m):v);if(!x){if(!b){c=d+(c.length>0?" "+c:c);continue}if(x=n(v),!x){c=d+(c.length>0?" "+c:c);continue}b=!1}const w=a(h).join(":"),k=p?w+R3:w,j=k+x;if(s.includes(j))continue;s.push(j);const _=o(x,b);for(let T=0;T<_.length;++T){const A=_[T];s.push(k+A)}c=d+(c.length>0?" "+c:c)}return c};function coe(){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=aoe(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=loe(c,r);return o(c,d),d}return function(){return a(coe.apply(null,arguments))}}const co=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},pU=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hU=/^\((?:(\w[\w-]*):)?(.+)\)$/i,doe=/^\d+\/\d+$/,foe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,poe=/\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$/,hoe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,goe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,moe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rg=e=>doe.test(e),Br=e=>!!e&&!Number.isNaN(Number(e)),mf=e=>!!e&&Number.isInteger(Number(e)),x5=e=>e.endsWith("%")&&Br(e.slice(0,-1)),Vu=e=>foe.test(e),voe=()=>!0,yoe=e=>poe.test(e)&&!hoe.test(e),gU=()=>!1,xoe=e=>goe.test(e),boe=e=>moe.test(e),woe=e=>!nr(e)&&!ir(e),Soe=e=>jv(e,yU,gU),nr=e=>pU.test(e),Ip=e=>jv(e,xU,yoe),b5=e=>jv(e,Eoe,Br),iN=e=>jv(e,mU,gU),joe=e=>jv(e,vU,boe),U0=e=>jv(e,bU,xoe),ir=e=>hU.test(e),vy=e=>kv(e,xU),koe=e=>kv(e,Aoe),oN=e=>kv(e,mU),_oe=e=>kv(e,yU),Coe=e=>kv(e,vU),H0=e=>kv(e,bU,!0),jv=(e,t,r)=>{const n=pU.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},kv=(e,t,r=!1)=>{const n=hU.exec(e);return n?n[1]?t(n[1]):r:!1},mU=e=>e==="position"||e==="percentage",vU=e=>e==="image"||e==="url",yU=e=>e==="length"||e==="size"||e==="bg-size",xU=e=>e==="length",Eoe=e=>e==="number",Aoe=e=>e==="family-name",bU=e=>e==="shadow",Toe=()=>{const e=co("color"),t=co("font"),r=co("text"),n=co("font-weight"),o=co("tracking"),a=co("leading"),s=co("breakpoint"),l=co("container"),c=co("spacing"),u=co("radius"),d=co("shadow"),f=co("inset-shadow"),h=co("text-shadow"),p=co("drop-shadow"),v=co("blur"),m=co("perspective"),b=co("aspect"),x=co("ease"),w=co("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...j(),ir,nr],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],P=()=>[ir,nr,c],N=()=>[Rg,"full","auto",...P()],O=()=>[mf,"none","subgrid",ir,nr],C=()=>["auto",{span:["full",mf,ir,nr]},mf,ir,nr],I=()=>[mf,"auto",ir,nr],R=()=>["auto","min","max","fr",ir,nr],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...P()],X=()=>[Rg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],$=()=>[e,ir,nr],ee=()=>[...j(),oN,iN,{position:[ir,nr]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",_oe,Soe,{size:[ir,nr]}],z=()=>[x5,vy,Ip],q=()=>["","none","full",u,ir,nr],G=()=>["",Br,vy,Ip],U=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Br,x5,oN,iN],re=()=>["","none",v,ir,nr],H=()=>["none",Br,ir,nr],ie=()=>["none",Br,ir,nr],de=()=>[Br,ir,nr],le=()=>[Rg,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vu],breakpoint:[Vu],color:[voe],container:[Vu],"drop-shadow":[Vu],ease:["in","out","in-out"],font:[woe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vu],shadow:[Vu],spacing:["px",Br],text:[Vu],"text-shadow":[Vu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rg,nr,ir,b]}],container:["container"],columns:[{columns:[Br,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:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[mf,"auto",ir,nr]}],basis:[{basis:[Rg,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Br,Rg,"auto","initial","none",nr]}],grow:[{grow:["",Br,ir,nr]}],shrink:[{shrink:["",Br,ir,nr]}],order:[{order:[mf,"first","last","none",ir,nr]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[l,"screen",...X()]}],"min-w":[{"min-w":[l,"screen","none",...X()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},...X()]}],h:[{h:["screen",...X()]}],"min-h":[{"min-h":["screen","none",...X()]}],"max-h":[{"max-h":["screen",...X()]}],"font-size":[{text:["base",r,vy,Ip]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ir,b5]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",x5,nr]}],"font-family":[{font:[koe,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":[Br,"none",ir,b5]}],leading:[{leading:[a,...P()]}],"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:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Br,"from-font","auto",ir,Ip]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Br,"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:P()}],"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:V()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mf,ir,nr],radial:["",ir,nr],conic:[mf,ir,nr]},Coe,joe]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Br,ir,nr]}],"outline-w":[{outline:["",Br,vy,Ip]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,H0,U0]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,H0,U0]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Br,Ip]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,H0,U0]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Br,ir,nr]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"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":[Br]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[ir,nr]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[Br]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ir,nr]}],filter:[{filter:["","none",ir,nr]}],blur:[{blur:re()}],brightness:[{brightness:[Br,ir,nr]}],contrast:[{contrast:[Br,ir,nr]}],"drop-shadow":[{"drop-shadow":["","none",p,H0,U0]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Br,ir,nr]}],"hue-rotate":[{"hue-rotate":[Br,ir,nr]}],invert:[{invert:["",Br,ir,nr]}],saturate:[{saturate:[Br,ir,nr]}],sepia:[{sepia:["",Br,ir,nr]}],"backdrop-filter":[{"backdrop-filter":["","none",ir,nr]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Br,ir,nr]}],"backdrop-contrast":[{"backdrop-contrast":[Br,ir,nr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Br,ir,nr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Br,ir,nr]}],"backdrop-invert":[{"backdrop-invert":["",Br,ir,nr]}],"backdrop-opacity":[{"backdrop-opacity":[Br,ir,nr]}],"backdrop-saturate":[{"backdrop-saturate":[Br,ir,nr]}],"backdrop-sepia":[{"backdrop-sepia":["",Br,ir,nr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"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:[Br,"initial",ir,nr]}],ease:[{ease:["linear","initial",x,ir,nr]}],delay:[{delay:[Br,ir,nr]}],animate:[{animate:["none",w,ir,nr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ir,nr]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[ir,nr,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",...$()]}],"stroke-w":[{stroke:[Br,vy,Ip,b5]}],stroke:[{stroke:["none",...$()]}],"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"]}},Poe=uoe(Toe);function ea(...e){return Poe(Fr(e))}function Ioe({...e}){return i.jsx(iU,{"data-slot":"dialog",...e})}function Ooe({...e}){return i.jsx(oU,{"data-slot":"dialog-portal",...e})}const wU=S.forwardRef(({className:e,...t},r)=>i.jsx(aU,{ref:r,"data-slot":"dialog-overlay",className:ea("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}));wU.displayName="DialogOverlay";function Noe({className:e,children:t,...r}){return i.jsxs(Ooe,{"data-slot":"dialog-portal",children:[i.jsx(wU,{}),i.jsxs(sU,{"data-slot":"dialog-content",className:ea("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(cU,{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(Gt,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Roe({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:ea("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Loe({className:e,...t}){return i.jsx(lU,{"data-slot":"dialog-title",className:ea("text-lg leading-none font-semibold",e),...t})}function Foe({open:e,onOpenChange:t,title:r,children:n,contentClassName:o}){return i.jsx(Ioe,{open:e,onOpenChange:t,children:i.jsxs(Noe,{className:o,children:[r&&i.jsx(Roe,{children:i.jsx(Loe,{children:r})}),n]})})}function aN({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 _h({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 zoe extends S.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(Wh,{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 Moe(){return S.useSyncExternalStore(Uee,LO,LO)?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"},SU="linear-gradient(135deg, rgb(11,77,209) 0%, rgb(29,102,239) 45%, rgb(107,53,210) 100%)",qc="#EF8D1D";function jU({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:qc}),i.jsx("path",{d:Ao.p33b7c800,fill:qc}),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:qc,transform:"rotate(75 17.7246 12.6819)"}),i.jsx("circle",{cx:"5.28744",cy:"5.28744",r:"5.28744",fill:qc,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:qc}),i.jsx("path",{d:Ao.p2fc98c00,fill:qc}),i.jsx("path",{d:Ao.p10df6080,fill:qc}),i.jsx("path",{d:Ao.p24dd2380,fill:qc})]}),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:qc}),i.jsx("path",{d:Ao.p5358df0,fill:qc})]})]})}function kU(){return i.jsxs("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:0,backgroundImage:SU,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 td({label:e,placeholder:t,value:r,onChange:n,type:o="text",required:a,showToggle:s,inputMode:l,autoComplete:c,name:u}){const[d,f]=S.useState(!1),[h,p]=S.useState(!1),v=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:v,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(gT,{size:15}):i.jsx(qh,{size:15})})]})]})}function _U({label:e,disabled:t}){const[r,n]=S.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 CU({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 a2({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 TT="951022141012-uqd3e8da53gj8vhbhg9ibha5f9k8jsqj.apps.googleusercontent.com";function Doe(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 EU({text:e,onCredential:t}){const r=S.useRef(null),n=S.useRef(t);return n.current=t,S.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:TT,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 Boe({onNavigateToLogin:e,onSuccess:t,onRegister:r,onRegisterWithGoogle:n}){const[o,a]=S.useState(""),[s,l]=S.useState(""),[c,u]=S.useState(""),[d,f]=S.useState(""),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState(null),[w,k]=S.useState(!1),j=async A=>{if(!n)return;x(null);const P=Doe(A);if(!(P!=null&&P.email)){x("Could not read your Google account details. Try again.");return}k(!0);try{const N=await n({idToken:A,teamName:o.trim()||void 0,firstName:P.given_name||void 0,lastName:P.family_name||void 0});if(N.error){x(N.error);return}t==null||t()}finally{k(!1)}},_=async A=>{if(A.preventDefault(),x(null),r){const P=await r({email:s,password:c,teamName:o.trim(),firstName:d||void 0,lastName:h||void 0});if(P.error){x(P.error);return}}t==null||t()},T=[{icon:i.jsx(Vi,{size:16}),label:"Manage all your events in one place"},{icon:i.jsx(Ri,{size:16}),label:"Track participants and attendance"},{icon:i.jsx(Ad,{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(kU,{}),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(jU,{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:T.map((A,P)=>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:A.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:A.label})]},P))})]}),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:[b&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:b}),n&&TT&&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(EU,{text:"signup_with",onCredential:A=>{j(A)}}),i.jsx(a2,{label:"or register with email"})]}),i.jsx(td,{label:"Team Name",placeholder:"Enter your team or organization name",value:o,onChange:a,type:"text",required:!0}),i.jsx(td,{label:"Email Address",placeholder:"Enter your email address",value:s,onChange:l,type:"email",required:!0}),r&&i.jsx(td,{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(td,{label:"First Name",placeholder:"First name",value:d,onChange:f,required:!0}),i.jsx(td,{label:"Last Name",placeholder:"Last name",value:h,onChange:p,required:!0})]}),i.jsx(td,{label:"Phone Number",placeholder:"Enter your phone number",value:v,onChange:m,type:"tel"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[i.jsx(_U,{label:"Create Account"}),i.jsx(a2,{label:"Already registered?"}),i.jsx(CU,{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 Woe({onNavigateToRegister:e,onSuccess:t,onLogin:r,onLoginWithGoogle:n,onCompleteTwoFactorLogin:o}){const[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState("password"),[p,v]=S.useState(null),[m,b]=S.useState(null),[x,w]=S.useState(!1),k=async T=>{if(n){b(null),w(!0);try{const A=await n(T);if("error"in A&&A.error){b(A.error);return}if("requiresTwoFactor"in A&&A.requiresTwoFactor){v(A.twoFactorToken),A.email&&s(A.email),h("2fa"),d("");return}t==null||t()}finally{w(!1)}}},j=()=>{h("password"),v(null),d(""),b(null)},_=async T=>{if(T.preventDefault(),b(null),f==="2fa"){if(!o||!p)return;const A=await o(p,u.trim());if(A.error){b(A.error);return}t==null||t();return}if(r){const A=await r(a,l);if("error"in A){b(A.error);return}if("requiresTwoFactor"in A&&A.requiresTwoFactor){v(A.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(kU,{}),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:SU,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(jU,{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(td,{label:"Email Address",placeholder:"Enter your email address",value:a,onChange:s,type:"email",required:!0}),r&&i.jsx(td,{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(td,{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(_U,{label:f==="2fa"?"Verify and sign in":"Sign In"}),f==="2fa"&&i.jsx("button",{type:"button",onClick:j,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&&TT&&i.jsxs(i.Fragment,{children:[i.jsx(a2,{label:"or"}),x&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Signing in with Google…"}),i.jsx(EU,{text:"signin_with",onCredential:T=>{k(T)}})]}),i.jsx(a2,{label:"New to EventBuzz?"}),i.jsx(CU,{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 qoe(){var c,u;const e=Ed(),t=Cd(),{user:r,checked:n,login:o,loginWithGoogleCredential:a,completeTwoFactorLogin:s}=Mr(),l=((u=(c=t.state)==null?void 0:c.from)==null?void 0:u.pathname)??"/home";return n&&r?i.jsx(gh,{to:l,replace:!0}):i.jsx(Woe,{onNavigateToRegister:()=>e("/register"),onSuccess:()=>e(l,{replace:!0}),onLogin:o,onLoginWithGoogle:a,onCompleteTwoFactorLogin:s})}function $oe(){const e=Ed(),{user:t,checked:r,register:n,registerWithGoogle:o}=Mr();return r&&t?i.jsx(gh,{to:"/home",replace:!0}):i.jsx(Boe,{onNavigateToLogin:()=>e("/login"),onSuccess:()=>e("/home",{replace:!0}),onRegister:n,onRegisterWithGoogle:o})}function Uoe(){const[e]=i$(),t=Ed(),r=e.get("token")||"",[n,o]=S.useState(!0),[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(!1);S.useEffect(()=>{if(!r){s("Missing invitation link."),o(!1);return}wa.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 x=async w=>{if(w.preventDefault(),!r||!u)return;b(!0),s(null);const k=await wa.inviteAccept({token:r,password:u,firstName:l!=null&&l.accountExists?void 0:f,lastName:l!=null&&l.accountExists?void 0:p});if(b(!1),k.error||!k.data){s(k.error||"Could not accept invitation.");return}const j=k.data;kf(j.token,j.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:x,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=>v(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 AU=S.createContext(null),Hoe="home";function Voe({children:e,activeNavFromUrl:t,setActiveNavToUrl:r}){const[n,o]=S.useState(Hoe),[a,s]=S.useState(null),[l,c]=S.useState(""),[u,d]=S.useState(!1),[f,h]=S.useState(!1),[p,v]=S.useState(null),[m,b]=S.useState(!1),[x,w]=S.useState(!1),[k,j]=S.useState(null),A={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:v,openAgendaSessionPanelOnce:m,setOpenAgendaSessionPanelOnce:b,permissionsOpenAddOnce:x,setPermissionsOpenAddOnce:w,pendingMicrositeBuilder:k,setPendingMicrositeBuilder:j};return i.jsx(AU.Provider,{value:A,children:e})}function Li(){const e=S.useContext(AU);if(!e)throw new Error("useAppNav must be used within AppNavProvider");return e}function sN(e){return e<640?"mobile":e<1024?"tablet":"desktop"}function Si(){const[e,t]=S.useState(()=>sN(window.innerWidth));return S.useEffect(()=>{const r=()=>t(sN(window.innerWidth));return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),e}const lN=[{id:"home",label:"Home",icon:i.jsx(vT,{size:16})},{id:"events",label:"All Events",icon:i.jsx(nS,{size:16})},{id:"activities",label:"Activities",icon:i.jsx(cS,{size:16})},{id:"design",label:"Design",icon:i.jsx(tm,{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(iS,{size:16})},{id:"all-participants",label:"Participants",icon:i.jsx(Ri,{size:16})},{id:"forms",label:"Forms & Workflow",icon:i.jsx(Sh,{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(n2,{size:16}),children:[{id:"content-library",label:"Library"},{id:"content-collections",label:"Collections"}]},{id:"messaging",label:"Messaging",icon:i.jsx(dd,{size:16}),children:[{id:"messaging-email",label:"Email"},{id:"messaging-whatsapp",label:"WhatsApp"},{id:"messaging-whatsapp-chatbots",label:"WhatsApp Chatbots"}]},{id:"payment",label:"Payment Settings",icon:i.jsx(xv,{size:16})},{id:"user-management",label:"User Management",icon:i.jsx(fd,{size:16})},{id:"settings",label:"Settings",icon:i.jsx(hc,{size:16})}];function TU(e,t){var r;return!!((r=e.children)!=null&&r.some(n=>n.id===t))}function Yoe(e,t){return t===e.id||TU(e,t)}function sh({label:e,children:t}){const[r,n]=S.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 cN({activeItem:e,onNavigate:t,showCollapsed:r,selectedEventId:n,onEventSelect:o}){const a=lN.filter(f=>f.children).reduce((f,h)=>(f[h.id]=TU(h,e),f),{}),[s,l]=S.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:lN.map(f=>{if(f.id==="events"){const m=e==="events",b=!!s.events&&!r;return r?i.jsx(sh,{label:"All Events",children:i.jsxs("button",{onClick:()=>t("events"),style:{...u(m||!!n),position:"relative"},onMouseEnter:x=>{m||(x.currentTarget.style.background="var(--accent)")},onMouseLeave:x=>{m||(x.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"),b||l(x=>({...x,events:!0}))},style:{...u(m),flex:1,borderRadius:"var(--radius-button) 0 0 var(--radius-button)",marginBottom:0,overflow:"hidden"},onMouseEnter:x=>{m||(x.currentTarget.style.background="var(--accent)")},onMouseLeave:x=>{m||(x.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&&!b&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--primary)",flexShrink:0,marginRight:"2px"}})]})})},"events")}const h=Yoe(f,e),p=!!s[f.id]&&!r;if(f.children){const m=i.jsxs("button",{onClick:()=>c(f.id),style:u(h),onMouseEnter:b=>{h||(b.currentTarget.style.background="var(--accent)")},onMouseLeave:b=>{h||(b.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(ka,{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(sh,{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(b=>{const x=e===b.id;return i.jsxs("button",{onClick:()=>t(b.id),style:{...u(x),padding:"5px 8px",fontSize:"var(--text-xs)",gap:"6px"},onMouseEnter:w=>{x||(w.currentTarget.style.background="var(--accent)")},onMouseLeave:w=>{x||(w.currentTarget.style.background="transparent")},children:[b.isAction&&i.jsx(gr,{size:11,style:{color:"var(--primary)",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:x?"var(--sidebar-accent-foreground)":b.isAction?"var(--primary)":"var(--card-foreground)"},children:b.label})]},b.id)})})})]},f.id)}const v=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(sh,{label:f.label,children:v},f.id):v})})}function PU(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 Goe(e){return PU(e).slice(0,2).toUpperCase()||"?"}function uN({collapsed:e,onNavigate:t}){const{theme:r,setTheme:n}=a$(),{user:o,logout:a}=Mr(),s=Ed(),l=(o==null?void 0:o.platform_admin)==="yes",c=PU(o??null),u=Goe(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(sh,{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(qO,{size:16}):i.jsx(WO,{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 v=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:v?"var(--sidebar)":"transparent",boxShadow:v?"var(--elevation-sm)":"none",color:v?"var(--sidebar-foreground)":"var(--muted)",transition:"background 0.15s, color 0.15s, box-shadow 0.15s"},onMouseEnter:m=>{v||(m.currentTarget.style.color="var(--sidebar-foreground)")},onMouseLeave:m=>{v||(m.currentTarget.style.color="var(--muted)")},title:p==="light"?"Light mode":"Dark mode",children:p==="light"?i.jsx(qO,{size:13}):i.jsx(WO,{size:13})},p)})})]}),l&&(e?i.jsx(sh,{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(fd,{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(fd,{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(sh,{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(hc,{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(hc,{size:16})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--sidebar-foreground)"},children:"Settings"})]}),e?i.jsx(sh,{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(Sre,{size:13})})]})]})}function dN(){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 fN({activeItem:e,onItemClick:t,collapsed:r,onToggleCollapse:n,drawerOpen:o,onDrawerClose:a,selectedEventId:s,onEventSelect:l}){const c=Si(),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(Gt,{size:15})})]}),i.jsx(dN,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:"4px 8px"},children:i.jsx(cN,{activeItem:e,onNavigate:d,showCollapsed:!1,selectedEventId:s,onEventSelect:f})}),i.jsx(uN,{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(ka,{size:14}):i.jsx(vd,{size:14})})]}),!r&&i.jsx(dN,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:r?"8px 4px":"4px 8px"},children:i.jsx(cN,{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(ka,{size:14})})}),i.jsx(uN,{collapsed:r,onNavigate:d})]})}const F3="eb:organization-subscription-updated",z3={Live:{bg:"#dcfce7",color:"#15803d",dot:"#16a34a"},Upcoming:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}},Koe={Physical:i.jsx(_b,{size:10}),Virtual:i.jsx(Wf,{size:10}),Hybrid:i.jsx(cS,{size:10})},PT=[{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}],IU=[{id:"p0",navId:"home",title:"Home",section:"Portfolio",description:"Dashboard home — AI event ideas and quick actions",icon:i.jsx(vT,{size:14})},{id:"p1",navId:"events",title:"All Events",section:"Portfolio",description:"Browse and manage all your events",icon:i.jsx(nS,{size:14})},{id:"p2",navId:"design-brochure",title:"Design · Brochure",section:"Design",description:"Create and manage event brochures",icon:i.jsx(tm,{size:14})},{id:"p3",navId:"design-microsite",title:"Design · Microsite Templates",section:"Design",description:"Manage microsite templates for events",icon:i.jsx(tm,{size:14})},{id:"p4",navId:"design-badges",title:"Design · Badges",section:"Design",description:"Create attendee and speaker badges",icon:i.jsx(tm,{size:14})},{id:"p5",navId:"design-emailers",title:"Design · Emailers",section:"Design",description:"Design email templates and newsletters",icon:i.jsx(tm,{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($h,{size:14})},{id:"p6",navId:"faculty",title:"Faculty & Speakers",section:"Portfolio",description:"Manage faculty profiles and speaker details",icon:i.jsx(iS,{size:14})},{id:"p7",navId:"all-participants",title:"Participants",section:"Portfolio",description:"View and manage all participants across events",icon:i.jsx(Ri,{size:14})},{id:"p8",navId:"forms-feedback",title:"Forms · Feedback",section:"Forms & Workflow",description:"Feedback forms and response analytics",icon:i.jsx(Sh,{size:14})},{id:"p9",navId:"forms-registration",title:"Forms · Registration",section:"Forms & Workflow",description:"Registration forms and submissions",icon:i.jsx(Sh,{size:14})},{id:"p10",navId:"content-library",title:"Content · Library",section:"Content",description:"Manage your content library and assets",icon:i.jsx(n2,{size:14})},{id:"p11",navId:"content-collections",title:"Content · Collections",section:"Content",description:"Organise content into curated collections",icon:i.jsx(n2,{size:14})},{id:"p12",navId:"messaging-email",title:"Messaging · Email",section:"Messaging",description:"Email campaigns, templates, and analytics",icon:i.jsx(dd,{size:14})},{id:"p13",navId:"messaging-whatsapp",title:"Messaging · WhatsApp",section:"Messaging",description:"WhatsApp messaging campaigns",icon:i.jsx(dd,{size:14})},{id:"p13b",navId:"messaging-whatsapp-chatbots",title:"WhatsApp Chatbots",section:"Messaging",description:"AI concierge bots per event",icon:i.jsx(dd,{size:14})},{id:"p14",navId:"payment",title:"Payment Settings",section:"Portfolio",description:"Configure payment gateways and billing",icon:i.jsx(xv,{size:14})},{id:"p15",navId:"user-management",title:"User Management",section:"Portfolio",description:"Manage team members, roles, and permissions",icon:i.jsx(fd,{size:14})},{id:"p16",navId:"settings",title:"Settings",section:"General",description:"Organisation, profile, and platform preferences",icon:i.jsx(hc,{size:14})},{id:"p17",navId:"dashboard",title:"Event Home",section:"Event",description:"Tracks, sessions, and schedule for the event",icon:i.jsx(Cb,{size:14})},{id:"p18",navId:"analytics",title:"Event Analytics",section:"Event",description:"Live stats, charts, and feature overview",icon:i.jsx(x$,{size:14})},{id:"p19",navId:"participants",title:"Event Participants",section:"Event",description:"Registrations, check-ins, and attendance",icon:i.jsx(Ri,{size:14})},{id:"p20",navId:"permissions",title:"Users & Permissions",section:"Event",description:"Manage event team members, roles, and session access",icon:i.jsx(fd,{size:14})},{id:"p21",navId:"event-activities",title:"Activities",section:"Event",description:"Polls, quizzes, and audience Q&A for sessions",icon:i.jsx(Ad,{size:14})},{id:"p23",navId:"rewards",title:"Reward Points",section:"Event",description:"Leaderboard, manual points, and attendee rankings",icon:i.jsx(dte,{size:14})},{id:"p24",navId:"ticketing",title:"Ticket configuration",section:"Event",description:"Configure ticket types, pricing, and UPI checkout",icon:i.jsx(A$,{size:14})}],Qoe=[{id:"a1",title:"Create New Event",description:"Set up a new conference, workshop, or CME",icon:i.jsx(gr,{size:14}),navTarget:"events"},{id:"a2",title:"Add Speaker / Faculty",description:"Add a new faculty or speaker profile",icon:i.jsx(iS,{size:14}),navTarget:"faculty"},{id:"a3",title:"New Email Campaign",description:"Draft and send an email campaign",icon:i.jsx(dd,{size:14}),navTarget:"messaging-email"},{id:"a4",title:"Invite Team Member",description:"Send an invitation to a team member",icon:i.jsx(Ri,{size:14}),navTarget:"user-management"},{id:"a5",title:"Upload Content",description:"Upload files, videos, or documents",icon:i.jsx(Fl,{size:14}),navTarget:"content-library"},{id:"a6",title:"Connect Payment Gateway",description:"Link Razorpay, Stripe, or other gateways",icon:i.jsx(xv,{size:14}),navTarget:"payment"}],Xoe=[{label:"Home",navId:"home",icon:i.jsx(vT,{size:12})},{label:"All Events",navId:"events",icon:i.jsx(nS,{size:12})},{label:"Faculty & Speakers",navId:"faculty",icon:i.jsx(iS,{size:12})},{label:"Design",navId:"design-brochure",icon:i.jsx(tm,{size:12})},{label:"Participants",navId:"all-participants",icon:i.jsx(Ri,{size:12})},{label:"Messaging",navId:"messaging-email",icon:i.jsx(dd,{size:12})},{label:"Settings",navId:"settings",icon:i.jsx(hc,{size:12})}];function OU(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=PT.filter(s=>r(s.title,s.subtitle,s.location,s.type,s.status)),o=IU.filter(s=>r(s.title,s.section,s.description)),a=Qoe.filter(s=>r(s.title,s.description));return{events:n,pages:o,actions:a,total:n.length+o.length+a.length}}function V0({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 pN({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:v})=>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:v})]});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,v)=>{const m=z3[p.status],b=r===v;return i.jsxs("button",{onClick:()=>n(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 14px",textAlign:"left",background:b?"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=b?"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(V0,{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(Ab,{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(Vi,{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,v)=>{const m=r===d+v;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:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.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(V0,{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(ka,{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,v)=>{const m=r===f+v;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:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.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(V0,{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(V0,{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(dT,{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:Xoe.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:v=>{v.currentTarget.style.borderColor="var(--primary)",v.currentTarget.style.color="var(--primary)"},onMouseLeave:v=>{v.currentTarget.style.borderColor="var(--border)",v.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"}),PT.slice(0,3).map(p=>{const v=z3[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:v.dot??v.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:v.bg,color:v.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:p.status})]},p.id)})]})]})}function NU(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 Zoe(e){return NU(e).slice(0,2).toUpperCase()||"?"}function Joe(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 eae(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 tae(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 rae({isMobile:e}){const{user:t}=Mr(),r=NU(t??null),n=Zoe(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 nae({onMenuClick:e,onNavigate:t,onEventSelect:r,onOpenSearchPage:n}){var q,G;const{user:o}=Mr(),{setActiveNav:a,setSettingsInitialSection:s}=Li(),[l,c]=S.useState(""),[u,d]=S.useState(!1),[f,h]=S.useState(-1),[p,v]=S.useState(!1),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState([]),[_,T]=S.useState(0),A=Si(),P=A==="mobile",N=A==="tablet",O=S.useRef(null),C=S.useRef(null),I=S.useRef(null),R=S.useMemo(()=>l.trim()?OU(l):null,[l]),F=S.useMemo(()=>R?[...R.events.slice(0,4).map(U=>({type:"event",data:U})),...R.pages.slice(0,5).map(U=>({type:"page",data:U})),...R.actions.slice(0,3).map(U=>({type:"action",data:U}))]:[],[R]);S.useEffect(()=>{const U=Q=>{O.current&&!O.current.contains(Q.target)&&(d(!1),h(-1))};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]),S.useEffect(()=>{const U=()=>T(Q=>Q+1);return window.addEventListener(F3,U),()=>window.removeEventListener(F3,U)},[]),S.useEffect(()=>{var Q;if(!((Q=o==null?void 0:o.organization)!=null&&Q._id)){w(null),j([]);return}let U=!1;return(async()=>{try{const[K,re]=await Promise.all([cs.get({cacheBust:_>0}),ed.catalog().then(H=>H.plans).catch(()=>[])]);U||(w(K),j(re))}catch{U||(w(null),j([]))}})(),()=>{U=!0}},[(q=o==null?void 0:o.organization)==null?void 0:q._id,_]);const M=S.useMemo(()=>{var le,ke,ve;if(!((le=o==null?void 0:o.organization)!=null&&le._id)||!x)return null;const U=(ke=x.subscription)==null?void 0:ke.plan,Q=Joe(U,k),K=eae(x,k),re=K==null?"Unlimited participants":`${K.toLocaleString("en-IN")} participants max`,H=tae((ve=x.subscription)==null?void 0:ve.expiresAt),ie=P?`${Q} · ${K==null?"∞":K.toLocaleString("en-IN")}${H.mobile}`:`${Q} · ${re}${H.desktop}`,de=`${Q} — ${re}.${H.title} Open Billing in Settings.`;return{label:ie,title:de}},[(G=o==null?void 0:o.organization)==null?void 0:G._id,x,k,P]);S.useEffect(()=>{const U=Q=>{var K;(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),P?(v(!0),setTimeout(()=>{var re;return(re=I.current)==null?void 0:re.focus()},50)):((K=C.current)==null||K.focus(),d(!0)))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[P]);const Y=U=>{if(U.key==="ArrowDown")U.preventDefault(),h(Q=>Math.min(Q+1,F.length-1));else if(U.key==="ArrowUp")U.preventDefault(),h(Q=>Math.max(Q-1,-1));else if(U.key==="Enter")if(f>=0&&F[f]){const Q=F[f];X(Q)}else l.trim()&&D();else U.key==="Escape"&&(d(!1),h(-1),v(!1))},X=U=>{U.type==="event"?r==null||r(U.data.id):U.type==="page"?t==null||t(U.data.navId):t==null||t(U.data.navTarget),z()},$=U=>{r==null||r(U.id),z()},ee=U=>{t==null||t(U.navId),z()},V=U=>{t==null||t(U.navTarget),z()},D=()=>{n==null||n(l),z()},z=()=>{d(!1),h(-1),v(!1),c("")};return i.jsxs(i.Fragment,{children:[i.jsxs("header",{style:{height:"52px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:P?"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:[(P||N)&&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:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},"aria-label":"Open menu",children:i.jsx(Ere,{size:18})}),P&&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"})]}),!P&&i.jsxs("div",{ref:O,style:{position:"relative"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 10px",height:"32px",width:N?"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:C,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:U=>{c(U.target.value),h(-1),d(!0)},onFocus:()=>{b(!0),d(!0)},onBlur:()=>b(!1),onKeyDown:Y,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(Gt,{size:12})}):!N&&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:N?"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(pN,{query:l,results:R,activeIndex:f,onEventClick:$,onPageClick:ee,onActionClick:V,onViewAll:D})})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[P&&i.jsx("button",{"aria-label":"Search",onClick:()=>{v(!0),setTimeout(()=>{var U;return(U=I.current)==null?void 0:U.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:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},children:i.jsx(pi,{size:16})}),M&&i.jsxs("button",{type:"button","aria-label":M.title,title:M.title,onClick:()=>{s("billing"),a("settings")},style:{display:"inline-flex",alignItems:"center",gap:"6px",maxWidth:P?"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:U=>{U.currentTarget.style.background="var(--accent)",U.currentTarget.style.borderColor="var(--primary)"},onMouseLeave:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.borderColor="var(--border)"},children:[i.jsx(xv,{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:M.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:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},children:[i.jsx(fT,{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(rae,{isMobile:P})]})]}),p&&i.jsxs("div",{style:{position:"fixed",inset:0,zIndex:300,display:"flex",flexDirection:"column"},children:[i.jsx("div",{onClick:()=>v(!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:I,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:U=>{c(U.target.value),h(-1)},onKeyDown:Y,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(Gt,{size:14})}),i.jsx("button",{onClick:()=>{v(!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(pN,{query:l,results:R,activeIndex:f,onEventClick:$,onPageClick:ee,onActionClick:V,onViewAll:D})})]})]})]})}const RU=[{id:"dashboard",label:"Event Home",shortLabel:"Home",icon:i.jsx(ure,{size:13})},{id:"participants",label:"Participants",shortLabel:"People",icon:i.jsx(Ri,{size:13})},{id:"attendance",label:"Attendance",shortLabel:"Attend",icon:i.jsx(hT,{size:13})},{id:"event-activities",label:"Activities",shortLabel:"Activities",icon:i.jsx(cS,{size:13})},{id:"rewards",label:"Reward Points",shortLabel:"Rewards",icon:i.jsx(nu,{size:13})},{id:"analytics",label:"Analytics",shortLabel:"Analytics",icon:i.jsx(x$,{size:13})}],iae=new Set([...RU.map(e=>e.id),"website","permissions","ticketing","questions","quiz"]);function oae({activeItem:e,onNavigate:t}){const r=S.useRef(null),o=Si()==="mobile",[a,s]=S.useState(!1),[l,c]=S.useState(!1);return S.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:RU.map(u=>{const d=e===u.id||u.id==="event-activities"&&(e==="questions"||e==="quiz");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 sc(e){return e==="dropdown"||e==="checkboxes"||e==="radio"}function Ch(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"field"}function aae(e){return{Conference:"conference",Workshop:"workshop",Summit:"summit",CME:"cme",Webinar:"webinar"}[e]||e.toLowerCase()}function sae(e){return{Draft:"draft",Upcoming:"upcoming",Live:"live",Completed:"completed"}[e]||e.toLowerCase()}function IT(e){return{Physical:"physical",Virtual:"virtual",Hybrid:"hybrid"}[e]||e.toLowerCase()}function w5(e){return new Date(e+"T12:00:00.000Z").toISOString()}function s2(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 lae(e){var l;const t=s2(e.startLocal),r=s2(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:IT(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 cae(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function LU(e,t,r){var p,v,m,b;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()&&((v=t.endLocal)!=null&&v.trim())){const x=s2(t.startLocal),w=s2(t.endLocal);if(!x||!w)throw new RangeError("Invalid start or end date/time.");if(new Date(w).getTime()<=new Date(x).getTime())throw new RangeError("End must be after start.");o=x,a=w}else{const x=e.startDate,w=e.endDate;o=typeof x=="string"?x:new Date(x).toISOString(),a=typeof w=="string"?w:new Date(w).toISOString()}const s=((m=t.locationType)==null?void 0:m.trim())||cae(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:((b=e.description)==null?void 0:b.trim())||void 0,type:d,status:f,startDate:o,endDate:a,location:l||void 0,locationType:IT(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(x=>typeof x=="string"&&x.trim()):[],metadata:{registrationCustomFields:[]}};return r!=null&&r.trim()&&(h.organization=r.trim()),h}function FU(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 zU(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:aae(c),status:sae(u),startDate:w5(e.startDate.trim()),endDate:w5(e.endDate.trim()),location:e.venue.trim()||void 0,locationType:IT(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?w5(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()||Ch(h.label)).replace(/[^a-z0-9_]/gi,"_"),fieldType:h.fieldType,options:sc(h.fieldType)?h.options.filter(p=>p.label.trim()&&p.value.trim()).map(p=>({value:p.value.trim(),label:p.label.trim()})):[]}))}}}const Qr={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"},Ba={...Qr,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 Wa({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:14,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Af({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 l2({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(Fl,{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 uae({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(bi,{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 Tf({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(uae,{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(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{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(bi,{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 OT=[{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"}],NT=[{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"}],MU=new Set(NT.map(e=>e.value)),DU=new Set(RT.map(e=>e.value));function BU(){return{id:Math.random().toString(36).slice(2),label:"",code:"",codeAuto:!0,fieldType:"text",options:[]}}const hN={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 S5(e){if(!e)return"";const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":t.toISOString().slice(0,10)}function dae(e){const t=(e||"conference").toLowerCase();return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function fae(e){const t=(e||"draft").toLowerCase();return{draft:"Draft",upcoming:"Upcoming",live:"Live",completed:"Completed"}[t]||"Draft"}function pae(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function hae(e){const t=typeof e=="string"?e:"";return MU.has(t)?t:"otp_email"}function gae(e){const t=typeof e=="string"?e:"";return DU.has(t)?t:"name_email"}function c2(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||Ch(String(d.label||""))),codeAuto:!d.code,fieldType:sc(h)||OT.some(p=>p.value===h)?h:"text",options:sc(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=pae(e.locationType);return{eventName:String(e.name||""),eventType:dae(e.type),description:String(e.description||e.subtitle||""),status:fae(e.status),locationType:u,venue:u==="Virtual"?"":String(e.location||""),virtualLink:u==="Physical"?"":c,startDate:S5(e.startDate),endDate:S5(e.endDate),registrationRequired:r,registrationMode:n,verifyEmail:t.verifyEmail===!1?"No":"Yes",registrationDeadline:t.registrationDeadline?S5(t.registrationDeadline):"",authenticationType:hae(t.authenticationType),registrationBaseFields:gae(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 mae(e,t){const r=c2(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 vae(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 yN(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||!MU.has(e.authenticationType))&&(r.authenticationType="Select an authentication type."),(!e.registrationBaseFields||!DU.has(e.registrationBaseFields))&&(r.registrationBaseFields="Select registration base fields.")),t!=null&&t.editMode||e.customFields.forEach(n=>Object.assign(r,yae(n))),r}function xae(...e){return e.reduce((t,r)=>({...t,...r}),{})}function vf(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function j5(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 k5=["eventName","eventType","description"],_5=["status","locationType","startDate","endDate","venue","virtualLink"],C5=["eventLogo","eventBanner"],pm=4;function bae({onClose:e,onSuccess:t,eventId:r}){const n=!!r,[o,a]=S.useState(1),[s,l]=S.useState(new Set),[c,u]=S.useState(hN),[d,f]=S.useState({}),[h,p]=S.useState(!1),[v,m]=S.useState(null),[b,x]=S.useState(null),[w,k]=S.useState(!!r),[j,_]=S.useState([]),T=S.useRef(null),A=S.useRef(null),P={editMode:n};S.useEffect(()=>{if(!r){k(!1),u(hN),_([]),l(new Set),a(1),x(null);return}k(!0),x(null),Lr.get(r).then(G=>{if(k(!1),G.error||!G.data){x(G.error||"Could not load event.");return}const U=G.data;u(c2(U));const Q=U.tags;_(Array.isArray(Q)?Q.map(String):[]),l(new Set([1,2,3,4])),a(1)})},[r]);const N=S.useCallback((G,U)=>{u(Q=>({...Q,[G]:U}))},[]),O=Math.round(s.size/pm*100),C=()=>u(G=>({...G,customFields:[...G.customFields,BU()]})),I=G=>{u(U=>({...U,customFields:U.customFields.filter(Q=>Q.id!==G)})),f(U=>{const Q={...U};return Object.keys(Q).forEach(K=>{(K.startsWith(`cf_${G}_`)||K===`cf_${G}_label`)&&delete Q[K]}),Q})},R=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>{if(K.id!==G)return K;const re={...K,label:U};return K.codeAuto&&(re.code=Ch(U)),re})}))},F=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>K.id===G?{...K,code:U,codeAuto:!1}:K)}))},M=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>{if(K.id!==G)return K;const re={...K,fieldType:U};return sc(U)&&K.options.length===0&&(re.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),sc(U)||(re.options=[]),re})}))},Y=G=>{u(U=>({...U,customFields:U.customFields.map(Q=>Q.id===G?{...Q,options:[...Q.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:Q)}))},X=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>K.id===G?{...K,options:K.options.filter(re=>re.id!==U)}:K)})),f(Q=>{const K={...Q};return delete K[`cf_${G}_opt_${U}`],K})},$=(G,U,Q,K)=>{u(re=>({...re,customFields:re.customFields.map(H=>H.id===G?{...H,options:H.options.map(ie=>ie.id===U?{...ie,[Q]:K}:ie)}:H)}))},ee=G=>{m(null);let U={};if(G===1?U=gN(c,P):G===2?U=mN(c,P):G===3?U=vN(c,P):G===4&&(U=yN(c,P)),Object.keys(U).length>0){f(Q=>{let K={...Q};return G===1&&(K=vf(K,k5)),G===2&&(K=vf(K,_5)),G===3&&(K=vf(K,C5)),G===4&&(K=vf(K,j5(c))),{...K,...U}}),a(G);return}G===1&&f(Q=>vf(Q,k5)),G===2&&f(Q=>vf(Q,_5)),G===3&&f(Q=>vf(Q,C5)),G===4&&f(Q=>vf(Q,j5(c))),l(Q=>new Set([...Q,G])),GzU(c,n?{tags:j}:void 0),D=async()=>{m(null);const G=xae(gN(c,P),mN(c,P),vN(c,P),yN(c,P));if(Object.keys(G).length>0){f(G);for(const K of[1,2,3,4]){let re=[];if(K===1&&(re=k5),K===2&&(re=_5),K===3&&(re=C5),K===4&&(re=j5(c)),re.some(H=>G[H])){a(K);break}}return}f({}),p(!0);const U=V(),Q=n&&r?await Lr.update(r,U):await Lr.create(U);p(!1),Q.data!=null&&!Q.error?(t==null||t(),e()):m(Q.error||"Could not save event. Please try again.")},z=G=>d[G],q=G=>a(U=>U===G?0:G);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(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:h||w||!!b,onClick:()=>D(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:h||w||b?"var(--secondary)":"var(--primary)",color:h||w||b?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:h||w||b?"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"})]})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 8px"},children:b}),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 ",pm," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",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:"#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(Tf,{n:1,title:"Basic Information",subtitle:"Core details about your event",open:o===1,completed:s.has(1),onToggle:()=>q(1),onNext:()=>ee(1),nextLabel:"Continue to Schedule & Location",nextDisabled:h,children:[i.jsxs(lr,{error:z("eventName"),children:[i.jsx(ur,{text:"Event Name",required:!0}),i.jsx("input",{style:{...Qr,...z("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:G=>N("eventName",G.target.value)})]}),i.jsxs(lr,{error:z("eventType"),children:[i.jsx(ur,{text:"Event type",required:!n}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("eventType")?{borderColor:"var(--destructive)"}:{}},value:c.eventType,onChange:G=>N("eventType",G.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:z("description"),children:[i.jsx(ur,{text:"Description",required:!n}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"80px",...z("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:G=>N("description",G.target.value)})]})]}),i.jsxs(Tf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>q(2),onNext:()=>ee(2),nextLabel:"Continue to Media & Tags",nextDisabled:h,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:z("status"),children:[i.jsx(ur,{text:"Status",required:!n}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:G=>N("status",G.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:z("locationType"),children:[i.jsx(ur,{text:"Location Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:G=>N("locationType",G.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:z("venue"),children:[i.jsx(ur,{text:"Venue / Address",required:!0}),i.jsx("input",{style:{...Qr,...z("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:G=>N("venue",G.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:z("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...z("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:G=>N("virtualLink",G.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z("startDate"),children:[i.jsx(ur,{text:"Start Date",required:!0}),i.jsx("input",{type:"date",style:{...Qr,...z("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:G=>N("startDate",G.target.value)})]}),i.jsxs(lr,{error:z("endDate"),children:[i.jsx(ur,{text:"End Date",required:!0}),i.jsx("input",{type:"date",style:{...Qr,...z("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:G=>N("endDate",G.target.value)})]})]})]}),i.jsxs(Tf,{n:3,title:"Media",subtitle:"Logo and banner (optional)",open:o===3,completed:s.has(3),onToggle:()=>q(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(l2,{label:"logo",preview:c.eventLogo,error:z("eventLogo"),inputRef:T,onFile:G=>{N("eventLogo",G),f(U=>{const Q={...U};return delete Q.eventLogo,Q})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner image"}),i.jsx(l2,{label:"banner",preview:c.eventBanner,error:z("eventBanner"),inputRef:A,onFile:G=>{N("eventBanner",G),f(U=>{const Q={...U};return delete Q.eventBanner,Q})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback",required:!n}),i.jsx(Af,{name:"enableFeedback",value:c.enableFeedback,onChange:G=>N("enableFeedback",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings",required:!n}),i.jsx(Af,{name:"enableRatings",value:c.enableRatings,onChange:G=>N("enableRatings",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Tf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>q(4),onNext:()=>D(),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(Af,{name:"regRequired",value:c.registrationRequired,onChange:G=>N("registrationRequired",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:z("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode",required:c.registrationRequired==="Yes"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:G=>N("registrationMode",G.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(Af,{name:"verifyEmail",value:c.verifyEmail,onChange:G=>N("verifyEmail",G),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:Qr,value:c.registrationDeadline,onChange:G=>N("registrationDeadline",G.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type",required:c.registrationRequired==="Yes"&&!n}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:G=>N("authenticationType",G.target.value),disabled:c.registrationRequired!=="Yes",children:NT.map(G=>i.jsx("option",{value:G.value,children:G.label},G.value))})})]}),i.jsxs(lr,{error:z("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields",required:c.registrationRequired==="Yes"&&!n}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:G=>N("registrationBaseFields",G.target.value),disabled:c.registrationRequired!=="Yes",children:RT.map(G=>i.jsx("option",{value:G.value,children:G.label},G.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((G,U)=>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 ",U+1]}),i.jsx("button",{type:"button",onClick:()=>I(G.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(Xr,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z(`cf_${G.id}_label`),children:[i.jsx(ur,{text:"Field Label",required:!0}),i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:G.label,onChange:Q=>R(G.id,Q.target.value)})]}),i.jsxs(lr,{error:z(`cf_${G.id}_code`),children:[i.jsx(ur,{text:"Field Code",required:!0}),i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:G.codeAuto?.92:1},placeholder:"auto from label",value:G.code||(G.codeAuto?Ch(G.label):""),onChange:Q=>F(G.id,Q.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:z(`cf_${G.id}_type`),children:[i.jsx(ur,{text:"Field Type",required:!0}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z(`cf_${G.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:G.fieldType,onChange:Q=>M(G.id,Q.target.value),children:OT.map(Q=>i.jsx("option",{value:Q.value,children:Q.label},Q.value))})})]}),sc(G.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)",required:!0}),z(`cf_${G.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:z(`cf_${G.id}_options`)}),G.options.map(Q=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:z(`cf_${G.id}_opt_${Q.id}`),children:i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_opt_${Q.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:Q.value,onChange:K=>$(G.id,Q.id,"value",K.target.value)})}),i.jsx(lr,{error:z(`cf_${G.id}_opt_${Q.id}`),children:i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_opt_${Q.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:Q.label,onChange:K=>$(G.id,Q.id,"label",K.target.value)})}),i.jsx("button",{type:"button",onClick:()=>X(G.id,Q.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(Xr,{size:14})})]},Q.id)),i.jsxs("button",{type:"button",onClick:()=>Y(G.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(gr,{size:12})," Add option"]})]})]},G.id)),i.jsxs("button",{type:"button",onClick:C,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(gr,{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:[v&&i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",flex:1},children:v}),i.jsx("button",{type:"button",disabled:h,onClick:()=>D(),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 Lg={},E5,xN;function wae(){return xN||(xN=1,E5=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),E5}var A5={},yf={},bN;function Uh(){if(bN)return yf;bN=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 yf.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},yf.getSymbolTotalCodewords=function(n){return t[n]},yf.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},yf.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},yf.isKanjiModeEnabled=function(){return typeof e<"u"},yf.toSJIS=function(n){return e(n)},yf}var T5={},wN;function LT(){return wN||(wN=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}}})(T5)),T5}var P5,SN;function Sae(){if(SN)return P5;SN=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++}},P5=e,P5}var I5,jN;function jae(){if(jN)return I5;jN=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]},I5=e,I5}var O5={},kN;function kae(){return kN||(kN=1,(function(e){const t=Uh().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},F5=t,F5}var z5={},M5={},D5={},IN;function qU(){return IN||(IN=1,D5.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),D5}var $c={},ON;function $U(){if(ON)return $c;ON=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 -]))+`;$c.KANJI=new RegExp(r,"g"),$c.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),$c.BYTE=new RegExp(n,"g"),$c.NUMERIC=new RegExp(e,"g"),$c.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return $c.testKanji=function(c){return o.test(c)},$c.testNumeric=function(c){return a.test(c)},$c.testAlphanumeric=function(c){return s.test(c)},$c}var NN;function Hh(){return NN||(NN=1,(function(e){const t=qU(),r=$U();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}}})(M5)),M5}var RN;function Pae(){return RN||(RN=1,(function(e){const t=Uh(),r=WU(),n=LT(),o=Hh(),a=qU(),s=7973,l=t.getBCHDigit(s);function c(h,p,v){for(let m=1;m<=40;m++)if(p<=e.getCapacity(m,v,h))return m}function u(h,p){return o.getCharCountIndicator(h,p)+4}function d(h,p){let v=0;return h.forEach(function(m){const b=u(m.mode,p);v+=b+m.getBitsLength()}),v}function f(h,p){for(let v=1;v<=40;v++)if(d(h,v)<=e.getCapacity(v,p,o.MIXED))return v}e.from=function(p,v){return a.isValid(p)?parseInt(p,10):v},e.getCapacity=function(p,v,m){if(!a.isValid(p))throw new Error("Invalid QR Code version");typeof m>"u"&&(m=o.BYTE);const b=t.getSymbolTotalCodewords(p),x=r.getTotalCodewordsCount(p,v),w=(b-x)*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,v){let m;const b=n.from(v,n.M);if(Array.isArray(p)){if(p.length>1)return f(p,b);if(p.length===0)return 1;m=p[0]}else m=p;return c(m.mode,m.getLength(),b)},e.getEncodedBits=function(p){if(!a.isValid(p)||p<7)throw new Error("Invalid QR Code version");let v=p<<12;for(;t.getBCHDigit(v)-l>=0;)v^=s<=0;)c^=t<0&&(a=this.data.substr(o),s=parseInt(a,10),n.put(s,l*3+1))},q5=t,q5}var $5,zN;function Nae(){if(zN)return $5;zN=1;const e=Hh(),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)},$5=r,$5}var U5,MN;function Rae(){if(MN)return U5;MN=1;const e=Hh();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)}},H5=r,H5}var V5={exports:{}},BN;function Fae(){return BN||(BN=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,v,m,b;!l.empty();){c=l.pop(),u=c.value,f=c.cost,h=r[u]||{};for(d in h)h.hasOwnProperty(d)&&(p=h[d],v=f+p,m=s[d],b=typeof s[d]>"u",(b||m>v)&&(s[d]=v,l.push(d,v),a[d]=u))}if(typeof o<"u"&&typeof s[o]>"u"){var x=["Could not find a path from ",n," to ",o,"."].join("");throw new Error(x)}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 WN;function zae(){return WN||(WN=1,(function(e){const t=Hh(),r=Oae(),n=Nae(),o=Rae(),a=Lae(),s=$U(),l=Uh(),c=Fae();function u(x){return unescape(encodeURIComponent(x)).length}function d(x,w,k){const j=[];let _;for(;(_=x.exec(k))!==null;)j.push({data:_[0],index:_.index,mode:w,length:_[0].length});return j}function f(x){const w=d(s.NUMERIC,t.NUMERIC,x),k=d(s.ALPHANUMERIC,t.ALPHANUMERIC,x);let j,_;return l.isKanjiModeEnabled()?(j=d(s.BYTE,t.BYTE,x),_=d(s.KANJI,t.KANJI,x)):(j=d(s.BYTE_KANJI,t.BYTE,x),_=[]),w.concat(k,j,_).sort(function(A,P){return A.index-P.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function h(x,w){switch(w){case t.NUMERIC:return r.getBitsLength(x);case t.ALPHANUMERIC:return n.getBitsLength(x);case t.KANJI:return a.getBitsLength(x);case t.BYTE:return o.getBitsLength(x)}}function p(x){return x.reduce(function(w,k){const j=w.length-1>=0?w[w.length-1]:null;return j&&j.mode===k.mode?(w[w.length-1].data+=k.data,w):(w.push(k),w)},[])}function v(x){const w=[];for(let k=0;k=0&&R<=6&&(F===0||F===6)||F>=0&&F<=6&&(R===0||R===6)||R>=2&&R<=4&&F>=2&&F<=4?T.set(C+R,I+F,!0,!0):T.set(C+R,I+F,!1,!0))}}function v(T){const A=T.size;for(let P=8;P>R&1)===1,T.set(O,C,I,!0),T.set(C,O,I,!0)}function x(T,A,P){const N=T.size,O=d.getEncodedBits(A,P);let C,I;for(C=0;C<15;C++)I=(O>>C&1)===1,C<6?T.set(C,8,I,!0):C<8?T.set(C+1,8,I,!0):T.set(N-15+C,8,I,!0),C<8?T.set(8,N-C-1,I,!0):C<9?T.set(8,15-C-1+1,I,!0):T.set(8,15-C-1,I,!0);T.set(N-8,8,1,!0)}function w(T,A){const P=T.size;let N=-1,O=P-1,C=7,I=0;for(let R=P-1;R>0;R-=2)for(R===6&&R--;;){for(let F=0;F<2;F++)if(!T.isReserved(O,R-F)){let M=!1;I>>C&1)===1),T.set(O,R-F,M),C--,C===-1&&(I++,C=7)}if(O+=N,O<0||P<=O){O-=N,N=-N;break}}}function k(T,A,P){const N=new r;P.forEach(function(F){N.put(F.mode.bit,4),N.put(F.getLength(),f.getCharCountIndicator(F.mode,T)),F.write(N)});const O=e.getSymbolTotalCodewords(T),C=l.getTotalCodewordsCount(T,A),I=(O-C)*8;for(N.getLengthInBits()+4<=I&&N.put(0,4);N.getLengthInBits()%8!==0;)N.putBit(0);const R=(I-N.getLengthInBits())/8;for(let F=0;F=7&&b(F,A),w(F,I),isNaN(N)&&(N=s.getBestMask(F,x.bind(null,F,P))),s.applyMask(N,F),x(F,P,N),{modules:F,version:A,errorCorrectionLevel:P,maskPattern:N,segments:O}}return A5.create=function(A,P){if(typeof A>"u"||A==="")throw new Error("No input text");let N=t.M,O,C;return typeof P<"u"&&(N=t.from(P.errorCorrectionLevel,t.M),O=u.from(P.version),C=s.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),_(A,O,N,C)},A5}var Y5={},G5={},$N;function UU(){return $N||($N=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 K5={},HN;function Bae(){if(HN)return K5;HN=1;const e=UU();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="',v='viewBox="0 0 '+f+" "+f+'"',b=''+h+p+` -`;return typeof l=="function"&&l(null,b),b},K5}var VN;function Wae(){if(VN)return Lg;VN=1;const e=wae(),t=Mae(),r=Dae(),n=Bae();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,v){try{const m=t.create(l,c);p(a(m,s,c))}catch(m){v(m)}})}try{const p=t.create(l,c);u(null,a(p,s,c))}catch(p){u(p)}}return Lg.create=t.create,Lg.toCanvas=o.bind(null,r.render),Lg.toDataURL=o.bind(null,r.renderToDataURL),Lg.toString=o.bind(null,function(a,s,l){return n.render(a,l)}),Lg}var qae=Wae();const _v=dn(qae);function $ae(e){return`https://eventbuzz.live/code/${e}`}function Uae(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 v=p.measureText(t).width,m=f+10,b=Math.ceil(Math.max(a+l*2,v+l*2)),x=c+s+u+m+d;h.width=b,h.height=x,p.fillStyle="#ffffff",p.fillRect(0,0,b,x);const w=(b-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,b/2,k);try{r(h.toDataURL("image/png"))}catch(j){n(j)}},o.onerror=()=>n(new Error("Failed to load QR image")),o.src=e})}function FT({open:e,onClose:t,kind:r,joinCode:n,label:o}){const a=n.trim(),s=a?$ae(a):"",[l,c]=S.useState(null),[u,d]=S.useState(null),[f,h]=S.useState(!1),[p,v]=S.useState(!1);S.useEffect(()=>{if(!e){c(null),d(null),h(!1);return}if(!s){c(null),d(null);return}let w=!1;return d(null),_v.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)})},b=async()=>{if(!(!a||!l||p)){v(!0);try{const w=await Uae(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{v(!1)}}};if(!e)return null;const x=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:[x," 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(Gt,{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(Js,{size:14})," ",f?"Copied":"Copy"]})]})]}),i.jsxs("button",{type:"button",onClick:()=>void b(),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(ja,{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."]})})]})})}const YN={display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",transition:"all 0.15s"};function Hae(){const{selectedEventId:e}=Li(),t=Si(),r=t==="mobile"||t==="tablet",[n,o]=S.useState(!1),[a,s]=S.useState(!1),[l,c]=S.useState(void 0);S.useEffect(()=>{if(!n||!e){c(void 0);return}c(void 0);let f=!1;return Lr.get(e).then(h=>{f||c(h.data??null)}),()=>{f=!0}},[n,e]);function u(){if(!e){window.alert("Select an event from the sidebar first.");return}o(!0)}function d(){!a&&!window.confirm("Start broadcasting this event as Live? All participants will be notified.")||s(f=>!f)}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:u,disabled:!e,style:{...YN,borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",opacity:e?1:.55,cursor:e?"pointer":"not-allowed"},onMouseEnter:f=>{e&&(f.currentTarget.style.borderColor="var(--primary)",f.currentTarget.style.color="var(--primary)")},onMouseLeave:f=>{f.currentTarget.style.borderColor="var(--border)",f.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Zf,{size:14}),r?"QR":"Generate QR Code"]}),i.jsxs("button",{type:"button",onClick:d,style:{...YN,borderColor:a?"var(--destructive)":"var(--border)",background:a?"var(--destructive)":"var(--card)",color:a?"var(--destructive-foreground)":"var(--card-foreground)"},onMouseEnter:f=>{a||(f.currentTarget.style.borderColor="var(--primary)",f.currentTarget.style.color="var(--primary)")},onMouseLeave:f=>{a||(f.currentTarget.style.borderColor="var(--border)",f.currentTarget.style.color="var(--card-foreground)")},children:[a?i.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"var(--destructive-foreground)",display:"block"}}):i.jsx(Hre,{size:14}),a?"Stop Live":"Go Live"]})]}),n&&e&&l!==void 0?i.jsx(FT,{open:!0,onClose:()=>o(!1),kind:"event",joinCode:((l==null?void 0:l.joinCode)??"").trim(),label:(l==null?void 0:l.name)??"Event"}):null,n&&e&&l===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…"})}):null]})}const D1=[{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 Vae(e){return e?D1.filter(t=>{const r=e[t.key];return r!=null&&Number(r)>0}).length:0}function Yae(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 Gae({initialRules:e,onClose:t,onSave:r,saving:n}){const[o,a]=S.useState(()=>{const c={};for(const{key:u}of D1){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 D1){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:201,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"reward-rules-title",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",{id:"reward-rules-title",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,"aria-label":"Close",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",marginLeft:"12px"},children:i.jsx(Gt,{size:16})})]}),i.jsx("div",{style:{padding:"20px 22px",display:"flex",flexDirection:"column",gap:"12px",overflowY:"auto"},children:D1.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(sS,{size:13})," Save"]})]})]})})}function Kae({eventId:e,onClose:t,onSaved:r}){const[n,o]=S.useState(null),[a,s]=S.useState(!0),[l,c]=S.useState(null),[u,d]=S.useState(!1);S.useEffect(()=>{let h=!1;return s(!0),c(null),Lr.get(e).then(p=>{h||(p.error||!p.data?(c(typeof p.error=="string"?p.error:"Failed to load event."),o(null)):o(p.data),s(!1))}),()=>{h=!0}},[e]);const f=async h=>{if(n){d(!0);try{(await Lr.update(e,Yae(n,h))).error||(r==null||r(),t())}finally{d(!1)}}};return a?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:201,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)"},children:i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",background:"var(--card)",padding:"16px 24px",borderRadius:"var(--radius-card)",border:"1px solid var(--border)"},children:"Loading reward rules…"})}):l||!n?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:201,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"20px 24px",maxWidth:400,border:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)",margin:"0 0 12px"},children:l??"Event not found."}),i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"Close"})]})}):i.jsx(Gae,{initialRules:n.rewardRules||{},onClose:t,onSave:f,saving:u})}const Ht={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"},Tr={...Ht,cursor:"pointer",appearance:"none",paddingRight:"32px"};({...Ht});const St=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.10)"},jt=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function ht({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 Vt({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 dt({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 ro({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function Zr({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Hi({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 u2({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(Gt,{size:10})})]})}function Qae(){return i.jsx("div",{style:{height:"1px",background:"var(--border)",margin:"4px 0"}})}function Nm({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 Xae({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(bi,{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 Ur({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(Xae,{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(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{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 ra({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,v=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(Gt,{size:14})}),!f&&i.jsx("button",{type:"button",disabled:!v,onClick:()=>v&&(u==null?void 0:u()),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:v?"var(--primary)":"var(--secondary)",color:v?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:v?"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 wc(e){const[t,r]=S.useState(1),[n,o]=S.useState(new Set);return{open:t,done:n,advance:l=>{o(c=>new Set([...c,l])),lr(c=>c===l?0:l)}}function Zae(e){return e?typeof e=="string"?e:String(e._id??""):""}const HU=["Star Rating","NPS (0–10)","Multiple Choice","Radio","Short Text","Long Text","Checkboxes","Yes / No"],VU=["Text","Email","Phone","Dropdown","Radio","Checkboxes","Yes / No","Date","File Upload"],Jae=[...new Set([...HU,...VU])],$f=new Set(["Multiple Choice","Dropdown","Radio","Checkboxes"]),GN={Text:"text",Email:"email",Phone:"phone",Dropdown:"select",Radio:"radio",Checkboxes:"checkboxes","Yes / No":"checkbox",Date:"text","File Upload":"file"},ese=[{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 YU(e){return(e.options??[]).map(t=>String(t).trim()).filter(Boolean)}function KN(e){return $f.has(e.type)?YU(e).length>=2:!0}function zT(){return["Option 1","Option 2"]}function GU({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:{...Ht,flex:1},placeholder:`Choice ${l+1}`,value:s,onChange:c=>n(l,c.target.value),onFocus:St,onBlur:jt}),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(Xr,{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(gr,{size:12})," Add choice"]}),i.jsx(Vt,{text:"At least two non-empty choices are required."})]})}function M3(){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 tse({q:e,types:t,onPatch:r,onRemove:n,idx:o,canRemove:a}){const s=$f.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(wv,{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:Ht,placeholder:`Question ${o+1}`,value:e.label,onChange:l=>r({label:l.target.value}),onFocus:St,onBlur:jt}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:{...Tr,width:"auto",minWidth:"130px"},value:e.type,onChange:l=>{var d;const c=l.target.value,u={type:c};$f.has(c)?u.options=(d=e.options)!=null&&d.length?e.options:zT():u.options=[],r(u)},onFocus:St,onBlur:jt,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(Xr,{size:13})})]}),s&&i.jsx(GU,{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 rse({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(wv,{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:Ht,placeholder:e.mapsTo==="email"?"Email address":"Label shown to registrants",value:e.label,onChange:n=>r({label:n.target.value}),onFocus:St,onBlur:jt})]})]})}function nse({q:e,types:t,onPatch:r,onRemove:n,idx:o}){const a=$f.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(wv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",alignItems:"start"},children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Field label"}),i.jsx("input",{style:Ht,placeholder:`Field ${o+1}`,value:e.label,onChange:s=>r({label:s.target.value}),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Field type"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:e.type,onChange:s=>{var u;const l=s.target.value,c={type:l};$f.has(l)?c.options=(u=e.options)!=null&&u.length?e.options:zT():c.options=[],r(c)},onFocus:St,onBlur:jt,children:t.map(s=>i.jsx("option",{children:s},s))})})]}),a&&i.jsx(dt,{span2:!0,children:i.jsx(GU,{options:e.options??[],onChange:s=>r({options:s})})}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Map to participant"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:e.mapsTo??"",onChange:s=>r({mapsTo:s.target.value}),onFocus:St,onBlur:jt,children:ese.map(s=>i.jsx("option",{value:s.value,children:s.label},s.value||"—"))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Required"}),i.jsx(Hi,{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(dt,{span2:!0,children:[i.jsx(ht,{text:"Custom field key",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. dietaryPreference",value:e.customMapsKey??"",onChange:s=>r({customMapsKey:s.target.value}),onFocus:St,onBlur:jt}),i.jsx(Vt,{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(Xr,{size:13})})]})})}const d2=e=>{const t=e[0];return{id:Math.random().toString(36).slice(2),label:"",type:t,required:"No",options:$f.has(t)?zT():[],mapsTo:"",customMapsKey:"",fixed:!1}},ise=(e,t)=>({name:"",description:"",questions:[d2(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 KU(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==="textarea"?r!=null&&r.includes("Long Text")?"Long Text":"Text":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 QU(e){return Array.isArray(e.options)?e.options.map(t=>String(t)):[]}function XU(e,t){var s;const r=((s=e.label)==null?void 0:s.trim())||"Untitled",n=e.required==="Yes",o=YU(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")return{label:r,type:"text",required:n};if(e.type==="Long Text")return{label:r,type:"textarea",required:n};if(e.type==="Yes / No")return{label:r,type:"checkbox",required:n};const l=GN[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=GN[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 ZU(e){return e==="firstName"||e==="lastName"||e==="email"}function ose(e){var n;const t=XU(e,!1),r=e.fixed===!0||ZU(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 ase(e){return e.isFixed===!0||ZU(e.mapsTo)||e.required?"Yes":"No"}function sse(e,t){return e!=null&&e.length?e.map((r,n)=>{const o=KU(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:$f.has(o)?QU(r):[],mapsTo:r.mapsTo,customMapsKey:r.customMapsKey,fixed:r.isFixed}}):[d2(t)]}function lse(e,t,r){const n=KU(e.type??"text",e.options,r);return{id:`imp-${t}-${Math.random().toString(36).slice(2)}`,label:e.label??"",type:n,required:ase(e),options:$f.has(n)?QU(e):[],mapsTo:e.mapsTo,customMapsKey:e.customMapsKey,fixed:e.isFixed===!0}}function cse(e,t){const r=M3();if(!(e!=null&&e.length))return r;const n=e.map((o,a)=>lse(o,a,t));return n.some(o=>o.mapsTo==="firstName")?n:[...r,...n]}function tx({eventId:e,formId:t,mode:r,defaultFormName:n,onClose:o,onSuccess:a}){const{user:s}=Mr(),l=Nn(s),c=r==="feedback",u=r==="registration",d=r==="other",f=u?5:3,h=u?VU:d?Jae:HU,p=c||d,v=wc(f),[m,b]=S.useState(()=>{const U=ise(h,p);return u?{...U,questions:M3()}:U}),[x,w]=S.useState([]),[k,j]=S.useState({}),[_,T]=S.useState(!1),[A,P]=S.useState(!!t),[N,O]=S.useState([]),[C,I]=S.useState("");S.useEffect(()=>{if(!l){O([]);return}let U=!1;return Lr.list({organization:l,recordKind:"event",limit:500}).then(Q=>{var re;if(U)return;const K=((re=Q.data)==null?void 0:re.events)??[];O(K.map(H=>{var ie;return{_id:H._id,name:(ie=H.name)!=null&&ie.trim()?H.name:"Untitled"}}))}).catch(()=>{U||O([])}),()=>{U=!0}},[l]),S.useEffect(()=>{!t&&e&&I(e)},[t,e]),S.useEffect(()=>{t||!(n!=null&&n.trim())||b(U=>U.name.trim()?U:{...U,name:n.trim()})},[t,n]),S.useEffect(()=>{if(u){if(!l){w([]);return}qa.list({organization:l}).then(U=>{var Q;(Q=U.data)!=null&&Q.lists&&w(U.data.lists.filter(K=>K.type==="fixed"))}).catch(()=>w([]))}},[u,l]),S.useEffect(()=>{if(!t)return;let U=!1;return(async()=>{var Q;try{const K=await Mo.get(t);if(U)return;const re=K.type==="registration"?cse(K.fields,h):sse(K.fields,h),H=K.settings??{},ie=Array.isArray(H.onSubmitAddTags)?H.onSubmitAddTags.join(", "):"";b({name:K.name??"",description:K.description??"",questions:re.length?re:K.type==="registration"?M3():[d2(h)],showThankYou:H.showThankYou===!1?"No":"Yes",thankYouMsg:(Q=H.thankYouMessage)!=null&&Q.trim()?H.thankYouMessage:"Thank you for your feedback!",collectEmail:H.collectEmail?"Yes":"No",anonymous:H.allowAnonymous||p?"Yes":"No",publish:H.isActive!==!1?"Published":"Draft",paymentEnabled:H.paymentEnabled?"Yes":"No",amount:H.paymentAmount!=null&&H.paymentAmount!==""?String(H.paymentAmount):"",confirmationEmail:H.sendConfirmationEmail===!1?"No":"Yes",onSubmitTags:ie,onSubmitListId:H.onSubmitParticipantListId??""}),I(Zae(K.event))}catch{U||P(!1)}finally{U||P(!1)}})(),()=>{U=!0}},[t,h.join(","),p]);const R=(U,Q)=>b(K=>({...K,[U]:Q})),F=()=>b(U=>({...U,questions:[...U.questions,d2(h)]})),M=U=>b(Q=>({...Q,questions:Q.questions.filter(K=>!K.fixed&&K.id!==U)})),Y=(U,Q)=>b(K=>({...K,questions:K.questions.map(re=>re.id===U?{...re,...Q}:re)})),X=S.useCallback((U,Q)=>{if(Q===1)return U.name.trim().length>0&&C.trim().length>0;if(Q===2){if(u){const H=U.questions.filter(le=>le.fixed).every(le=>le.label.trim().length>0),de=U.questions.filter(le=>!le.fixed).every(le=>{var ke;return!(!le.label.trim()||le.mapsTo==="custom"&&!((ke=le.customMapsKey)!=null&&ke.trim())||!KN(le))});return H&&de}const K=U.questions.some(H=>H.label.trim().length>0),re=U.questions.every(H=>!H.label.trim()||KN(H));return K&&re}return!0},[u,C]),$=S.useCallback(U=>{const Q=X(m,U);j(K=>({...K,[U]:Q?"":"Please complete required fields before continuing."})),Q&&v.advance(U)},[m,X,v]),ee=S.useCallback(()=>{const U=u?"registration":d?"other":"feedback",Q=u?m.questions.filter(H=>H.label.trim()).map(H=>ose(H)):m.questions.filter(H=>H.label.trim()).map(H=>XU(H,p)),K=m.publish==="Published",re=m.onSubmitTags.split(/[,;\n]+/).map(H=>H.trim()).filter(Boolean);return{name:m.name.trim(),description:m.description.trim(),type:U,fields:Q,settings:{isActive:K,thankYouMessage:m.thankYouMsg.trim(),showThankYou:m.showThankYou==="Yes",collectEmail:m.collectEmail==="Yes",allowAnonymous:m.anonymous==="Yes",paymentEnabled:m.paymentEnabled==="Yes",paymentAmount:m.paymentEnabled==="Yes"&&m.amount.trim()?m.amount.trim():"",sendConfirmationEmail:m.confirmationEmail==="Yes",...u?{onSubmitAddTags:re,onSubmitParticipantListId:m.onSubmitListId.trim()||null}:{}}}},[m,u,d,p]),V=S.useCallback(async()=>{if(!m.name.trim()||!C.trim()){C.trim()||j(U=>({...U,1:"Select an event for this form."}));return}T(!0),j({});try{const U=ee();t?await Mo.update(t,{...U,event:C}):await Mo.create({...U,event:C}),a(),o()}catch{j(U=>({...U,1:"Failed to save. Please try again."}))}finally{T(!1)}},[m.name,t,C,ee,a,o]),D=S.useCallback(()=>{const U=u?5:3;if(!X(m,U)){j(Q=>({...Q,[U]:"Please complete required fields."}));return}j(Q=>({...Q,[U]:""})),V()},[m,u,X,V]),z=c?"Forms & Workflow · Feedback":u?"Forms & Workflow · Registration":"Forms & Workflow · Other Forms",q=t?c?"Edit Feedback Form":u?"Edit Registration Form":"Edit Form":c?"Create Feedback Form":u?"Create Registration Form":"Create Other Form",G=c?"Design a feedback form to collect responses from your attendees.":u?"Build a registration form; each submission creates or updates a participant.":"Build custom forms (other / general-purpose) for your event.";return A?i.jsx(ra,{onClose:o,title:q,breadcrumb:z,description:G,completedCount:0,totalSections:f,ctaLabel:"Save",ctaDisabled:!0,children:i.jsx("div",{style:{padding:"20px",color:"var(--muted)"},children:"Loading form…"})}):i.jsxs(ra,{onClose:o,title:q,breadcrumb:z,description:G,completedCount:v.done.size,totalSections:f,ctaLabel:"Save",ctaDisabled:!m.name.trim()||!C.trim()||_||!t&&N.length===0,onCtaClick:V,children:[i.jsxs(Ur,{n:1,title:"Form Details",subtitle:"Name and describe your form",open:v.open===1,completed:v.done.has(1),onToggle:()=>v.toggle(1),onSave:()=>$(1),nextLabel:p?"Questions":"Fields",sectionError:k[1],children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Form Name",required:!0}),i.jsx("input",{style:Ht,placeholder:p?"e.g. Post-Event Feedback 2026":"e.g. Conference Registration 2026",value:m.name,onChange:U=>R("name",U.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Event",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:C,onChange:U=>I(U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select an event…"}),C&&!N.some(U=>U._id===C)?i.jsx("option",{value:C,children:"Current linked event"}):null,N.map(U=>i.jsx("option",{value:U._id,children:U.name},U._id))]})}),l&&N.length===0?i.jsx(Vt,{text:"No events in this organization. Create an event under Portfolio (All Events) first."}):null]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe this form…",value:m.description,onChange:U=>R("description",U.target.value),onFocus:St,onBlur:jt})]}),p&&i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Anonymous Responses",required:!0}),i.jsx(Hi,{name:"anon",value:m.anonymous,onChange:U=>R("anonymous",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Anonymous forms don't record the respondent's identity."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Collect Email"}),i.jsx(Hi,{name:"collectEmail",value:m.collectEmail,onChange:U=>R("collectEmail",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Ur,{n:2,title:p?"Questions":"Form Fields",subtitle:u?"Core fields (first name, last name, email) plus optional mapped fields":p?"Add and order your feedback questions":"Add and arrange fields",open:v.open===2,completed:v.done.has(2),onToggle:()=>v.toggle(2),onSave:()=>$(2),nextLabel:u?"Participant actions":"Settings",sectionError:k[2],children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u?i.jsxs(i.Fragment,{children:[m.questions.filter(U=>U.fixed).map((U,Q)=>i.jsx(rse,{q:U,idx:Q,onPatch:K=>Y(U.id,K)},U.id)),m.questions.filter(U=>!U.fixed).map((U,Q)=>i.jsx(nse,{q:U,types:h,idx:Q,onPatch:K=>Y(U.id,K),onRemove:()=>M(U.id)},U.id))]}):m.questions.map((U,Q)=>i.jsx(tse,{q:U,types:h,idx:Q,onPatch:K=>Y(U.id,K),onRemove:()=>M(U.id),canRemove:m.questions.length>1},U.id))}),u?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(gr,{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(gr,{size:13})," Add ",p?"Question":"Field"]}),i.jsx(Vt,{text:u?"Submissions must include the email field. Map extra fields to participant columns or customFields.":"Drag the grip icon to reorder questions."})]}),u&&i.jsxs(Ur,{n:3,title:"Participant actions",subtitle:"Tags and lists applied when someone submits",open:v.open===3,completed:v.done.has(3),onToggle:()=>v.toggle(3),onSave:()=>$(3),nextLabel:"Payment",sectionError:k[3],children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Add tags on submit"}),i.jsx("input",{style:Ht,placeholder:"e.g. VIP, Registered — comma separated",value:m.onSubmitTags,onChange:U=>R("onSubmitTags",U.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Merged onto the participant record (deduplicated)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Add to fixed participant list"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:m.onSubmitListId,onChange:U=>R("onSubmitListId",U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"— None —"}),x.map(U=>i.jsx("option",{value:U._id,children:U.name},U._id))]})}),i.jsx(Vt,{text:"Only fixed (manual) lists in your organization are shown."})]})]}),u&&i.jsx(Ur,{n:4,title:"Payment",subtitle:"Configure payment settings for paid registrations",open:v.open===4,completed:v.done.has(4),onToggle:()=>v.toggle(4),onSave:()=>$(4),nextLabel:"Publish Settings",sectionError:k[4],children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Enable Payment",required:!0}),i.jsx(Hi,{name:"regPayment",value:m.paymentEnabled,onChange:U=>R("paymentEnabled",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),m.paymentEnabled==="Yes"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Registration Fee (₹)",required:!0}),i.jsx("input",{type:"number",style:Ht,placeholder:"0.00",value:m.amount,onChange:U=>R("amount",U.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Confirmation Email",required:!0}),i.jsx(Hi,{name:"confEmail",value:m.confirmationEmail,onChange:U=>R("confirmationEmail",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Send a confirmation email after registration."})]})]})}),i.jsx(Ur,{n:u?5:3,title:"Publish Settings",subtitle:"Set the form status and thank-you message",open:v.open===(u?5:3),completed:v.done.has(u?5:3),onToggle:()=>v.toggle(u?5:3),onSave:D,nextLabel:"Save",sectionError:k[u?5:3],children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Status",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:m.publish,onChange:U=>R("publish",U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Published"})]})})]}),i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Thank You Message"}),i.jsx("input",{style:Ht,placeholder:"Thank you for your response!",value:m.thankYouMsg,onChange:U=>R("thankYouMsg",U.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Shown to respondents after they submit the form."})]})]})})]})}function use(e){return!e||typeof e!="object"?{}:e}function dse(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return"—"}}function fse(e){var t;return!e||typeof e=="string"?"—":((t=e.email)==null?void 0:t.trim())||"—"}const QN=20,XN=4;function D3({formId:e,formName:t,onClose:r}){const[n,o]=S.useState(null),[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(1),[k,j]=S.useState([]),[_,T]=S.useState(0),[A,P]=S.useState(!0),[N,O]=S.useState(null),[C,I]=S.useState(!1),R=((n==null?void 0:n.fields)||[]).map(D=>{var z;return(z=D.label)==null?void 0:z.trim()}).filter(Boolean),F=R.slice(0,XN),M=Math.max(0,R.length-F.length),Y=S.useCallback(async()=>{try{const D=await Mo.get(e);o(D)}catch{o(null)}},[e]),X=S.useCallback(async()=>{P(!0),O(null);try{const D=await Mo.listSubmissions(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0,page:x,limit:QN});j(D.submissions),T(D.total)}catch(D){O(D instanceof Error?D.message:"Failed to load submissions."),j([]),T(0)}finally{P(!1)}},[e,l,p,m,x]);S.useEffect(()=>{Y()},[Y]),S.useEffect(()=>{X()},[X]);const $=()=>{c(a.trim()),v(u),b(f),w(1)},ee=async()=>{I(!0);try{const D=await Mo.exportSubmissionsCsv(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0}),z=URL.createObjectURL(D),q=document.createElement("a");q.href=z,q.download=`form-${e}-submissions.csv`,q.click(),URL.revokeObjectURL(z)}catch(D){O(D instanceof Error?D.message:"Export failed.")}finally{I(!1)}},V=Math.max(1,Math.ceil(_/QN));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(Gt,{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:D=>s(D.target.value),onKeyDown:D=>D.key==="Enter"&&$(),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:D=>d(D.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:D=>h(D.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:$,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:C||_===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:C||_===0?"not-allowed":"pointer",opacity:C||_===0?.6:1},children:[i.jsx(ja,{size:14}),C?"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.",M>0?` The table only shows the first ${XN} response fields (${M} more in the file only).`:null]})]}),i.jsxs("div",{style:{flex:1,overflow:"auto",padding:"0 0 16px"},children:[N?i.jsx("p",{style:{padding:"16px 18px",margin:0,color:"var(--destructive)",fontSize:"var(--text-sm)"},children:N}):null,A?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"}),F.map(D=>i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",maxWidth:180},children:D},D)),M>0?i.jsxs("th",{style:{textAlign:"left",padding:"10px 12px",color:"var(--muted)",fontWeight:600,whiteSpace:"nowrap"},children:["+",M," more…"]},"__more__"):null]})}),i.jsx("tbody",{children:k.map(D=>{const z=use(D.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:dse(D.submittedAt)}),i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-all"},children:fse(D.participant)}),F.map(q=>i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-word",maxWidth:220},children:pse(z[q])},q)),M>0?i.jsx("td",{style:{padding:"10px 12px",color:"var(--muted)",fontSize:"10px",fontStyle:"italic"},children:"Export for full data"},"__more__"):null]},D._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 ",x," of ",V]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",disabled:x<=1||A,onClick:()=>w(D=>Math.max(1,D-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:x<=1||A?"not-allowed":"pointer",opacity:x<=1||A?.5:1},children:[i.jsx(vd,{size:16})," Prev"]}),i.jsxs("button",{type:"button",disabled:x>=V||A,onClick:()=>w(D=>D+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:x>=V||A?"not-allowed":"pointer",opacity:x>=V||A?.5:1},children:["Next ",i.jsx(ka,{size:16})]})]})]})]})]})}function pse(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}const hse={fullWidthCenter:!0,shrinkToFit:!0,textAlign:"center",x:0,w:100};function Pb(e){return e.fullWidthCenter!==!1}function G0(e){return e.shrinkToFit!==!1}function gse(e){return Pb(e)?e.textAlign??"center":e.textAlign??"left"}function JU(e){return e.field==="qr"||e.field==="photo"||e.kind==="custom_image"}function mse(e){return e.field==="qr"}function f2(e){return e.w??(e.field==="qr"?28:e.kind==="custom_image"?25:18)}function vse(e,t){return Math.min(WT,Math.max(BT,t))}function yse(e){return Math.min(WT,Math.max(BT,e))}function Rm(e,t,r){const n=t>0?t:1;return yse(e*r/n)}function xse(e){return new Promise(t=>{const r=new Image;r.onload=()=>t(r.naturalWidth>0&&r.naturalHeight>0?r.naturalWidth/r.naturalHeight:1),r.onerror=()=>t(1),r.src=e})}function eH(e){const t=URL.createObjectURL(e);return xse(t).finally(()=>URL.revokeObjectURL(t))}function MT(e,t,r){const n=vse(e,t),o={w:n};if(mse(e)||e.field==="photo")o.h=n;else if(e.kind==="custom_image"){const s=e.imageAspectRatio??1;o.h=Rm(n,s,r)}const a={...e,...o};return{...o,...DT(a,a.x,a.y)}}function bse(e){if(e.field==="qr"){const t=f2(e);return{w:t,h:t}}if(e.kind==="custom_image")return{w:e.w??25,h:e.h??25};if(e.field==="photo"){const t=f2(e);return{w:t,h:t}}return pS(e)?Pb(e)?{w:0,h:Math.max(4,(e.fontSizePct??5)*2)}:{w:e.w??72,h:Math.max(4,(e.fontSizePct??5)*2.5)}:{w:0,h:0}}function DT(e,t,r){const n=bse(e),o=n.w>0?Math.max(0,100-n.w):100,a=n.h>0?Math.max(0,100-n.h):100;let s=Math.min(o,Math.max(0,t));const l=Math.min(a,Math.max(0,r));return pS(e)&&Pb(e)&&(s=0),{x:s,y:l}}const B3=[{id:"Inter",label:"Inter",css:"var(--font-inter), Inter, sans-serif"},{id:"Noto Sans",label:"Noto Sans",css:"var(--font-noto-sans), 'Noto Sans', sans-serif"},{id:"Arial",label:"Arial",css:"Arial, sans-serif"},{id:"Georgia",label:"Georgia",css:"Georgia, serif"},{id:"Times New Roman",label:"Times New Roman",css:"'Times New Roman', Times, serif"}],wse="#0f172a",xy=5,Q5=5,BT=8,WT=65,ZN={a6:{w:105,h:148},a7:{w:74,h:105},"4x3in":{w:101.6,h:76.2},"4x6in":{w:101.6,h:152.4}};function Sse(e,t,r,n){let o,a;if(e==="custom")o=parseFloat(r||"105")||105,a=parseFloat(n||"148")||148;else{const s=ZN[e]||ZN.a6;o=s.w,a=s.h}return t==="landscape"&&([o,a]=[a,o]),o/a}function jse(e){const t=(e||"#000000").replace("#",""),r=parseInt(t.slice(0,2),16)||0,n=parseInt(t.slice(2,4),16)||0,o=parseInt(t.slice(4,6),16)||0;return(.299*r+.587*n+.114*o)/255>.55?"#0f172a":"#ffffff"}function tH(e,t){return{color:t==="color"?jse(e):wse,fontFamily:"Inter",fontWeight:"normal",...hse}}function rH(e,t,r){const n={kind:"field",field:e,id:e,...tH(t,r)};switch(e){case"name":return{...n,y:8,fontSizePct:7,fontWeight:"bold"};case"title":return{...n,y:22,fontSizePct:4.5};case"org":return{...n,y:32,fontSizePct:4};case"badge_type":return{...n,y:44,fontSizePct:3.5};case"photo":return{kind:"field",field:e,id:e,x:74,y:6,w:18,h:18};case"qr":return{kind:"field",field:e,id:e,x:36,y:68,w:28,h:28};default:return{...n,y:8,fontSizePct:5}}}function nH(e,t,r){return e.filter(n=>["name","title","org","badge_type","qr","photo"].includes(n)).map(n=>rH(n,t,r))}function kse(e,t,r,n,o){return{id:e,kind:"custom_text",text:t,y:55+o*8,fontSizePct:4,fontWeight:"normal",...tH(r,n)}}function _se(){return`custom_${Math.random().toString(16).slice(2,10)}`}function Cse(){return`cimg_${Math.random().toString(16).slice(2,10)}`}function iH(e,t,r,n,o){const s=Rm(25,o,n);return{id:e,kind:"custom_image",imageUrl:t,imageAspectRatio:o,x:10+r*4,y:50+r*6,w:25,h:s}}function oH(e,t){var r;return(e.imageUrl??((r=t.find(n=>n.id===e.id))==null?void 0:r.imageUrl)??"").trim()}function Ese(e){const t=B3.find(r=>r.id===e);return(t==null?void 0:t.css)??B3[0].css}function Ase(e){return{name:"Jane Doe",title:"Keynote Speaker",org:"Acme Inc.",badgeType:e.trim()||"Attendee"}}const JN=["#2563eb","#16a34a","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#b45309"];function Tse(e){var r;const t=e.split(/\s+/).filter(Boolean);return t.length>=2?`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`.toUpperCase():(((r=t[0])==null?void 0:r.charAt(0))||"J").toUpperCase()}function Pse(e){let t=0;for(let r=0;r[_.id,_.text])),u=new Map(n.map(_=>[_.id,_.imageUrl])),d=e.filter(_=>_.kind==="field"&&_.field&&l.has(_.field)),f=e.filter(_=>_.kind==="custom_text"&&c.has(_.id)),h=e.filter(_=>_.kind==="custom_image"&&u.has(_.id)),p=new Set(d.map(_=>_.field)),v=t.filter(_=>["name","title","org","badge_type","qr","photo"].includes(_)).filter(_=>!p.has(_)).map(_=>rH(_,o,a)),m=new Set(f.map(_=>_.id)),b=r.filter(_=>!m.has(_.id)).map((_,T)=>kse(_.id,_.text,o,a,T)),x=new Set(h.map(_=>_.id)),w=n.filter(_=>!x.has(_.id)).map((_,T)=>iH(_.id,_.imageUrl,T,s,1)),k=[...f.map(_=>({..._,text:c.get(_.id)??_.text})),...b],j=[...h.map(_=>{const T=u.get(_.id)??_.imageUrl,A=_.imageAspectRatio??1,P=_.w??25;return{..._,imageUrl:T,h:Rm(P,A,s)}}),...w];return[...d,...v,...k,...j]}function Ose({aspectRatio:e,backgroundMode:t,backgroundColor:r,backgroundImageUrl:n,layoutElements:o,customImages:a,badgeTypeLabel:s,badgeAspectRatio:l,selectedId:c,onSelect:u,onLayoutChange:d}){const f=S.useRef(null),h=S.useRef(o),p=S.useRef(d),v=S.useRef(null),m=S.useRef(null),b=S.useRef(""),[,x]=$e.useState(0);h.current=o,p.current=d;const w=Ase(s);S.useEffect(()=>{_v.toDataURL("eventbuzz:preview:sample",{width:120,margin:1}).then(A=>{b.current=A,x(P=>P+1)}).catch(()=>{b.current=""})},[]);const k=S.useCallback((A,P)=>{const N=h.current.map(O=>O.id===A?{...O,...P}:O);h.current=N,p.current(N)},[]);S.useEffect(()=>{const A=N=>{var R;const O=(R=f.current)==null?void 0:R.getBoundingClientRect();if(!(O!=null&&O.width)||!O.height)return;const C=v.current;if(C){const F=h.current.find($=>$.id===C.id);if(!F)return;N.preventDefault();const M=(N.clientX-C.startX)/O.width*100,Y=(N.clientY-C.startY)/O.height*100,X=DT(F,C.origX+M,C.origY+Y);k(C.id,X);return}const I=m.current;if(I){const F=h.current.find($=>$.id===I.id);if(!F)return;N.preventDefault();const M=(N.clientX-I.startX)/O.width*100,Y=(N.clientY-I.startY)/O.height*100,X=(M+Y)/2;k(I.id,MT(F,I.origW+X,l))}},P=()=>{v.current=null,m.current=null};return window.addEventListener("pointermove",A,{passive:!1}),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)}},[k]);const j=(A,P)=>{m.current||(A.preventDefault(),A.stopPropagation(),u(P.id),v.current={id:P.id,startX:A.clientX,startY:A.clientY,origX:P.x,origY:P.y})},_=(A,P)=>{A.preventDefault(),A.stopPropagation(),u(P.id),v.current=null,m.current={id:P.id,startX:A.clientX,startY:A.clientY,origW:f2(P)}},T=t==="image"&&n.trim()?{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:r};return i.jsxs("div",{style:{padding:"8px 12px 16px 20px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 10px"},children:"Live preview — drag to move; drag corner handle to resize"}),i.jsx("div",{ref:f,role:"presentation",onClick:()=>u(null),style:{width:"100%",maxWidth:420,aspectRatio:String(e),position:"relative",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)",overflow:"hidden",containerType:"size",touchAction:"none",...T,cursor:"default",userSelect:"none"},children:o.map(A=>i.jsx(Nse,{el:A,sample:w,customImages:a,selected:c===A.id,qrUrl:b.current,onDragStart:j,onResizeStart:_},A.id))})]})}function Nse({el:e,sample:t,customImages:r,selected:n,qrUrl:o,onDragStart:a,onResizeStart:s}){const l=n?"2px solid var(--primary)":"1px dashed transparent",c=JU(e),u=f2(e),d=(f,h)=>i.jsxs("div",{onPointerDown:p=>a(p,e),onClick:p=>p.stopPropagation(),style:{position:"absolute",left:`${e.x}%`,top:`${e.y}%`,width:`${u}%`,aspectRatio:"1",border:l,borderRadius:e.field==="photo"?"50%":4,cursor:"grab",boxSizing:"border-box",touchAction:"none",...h},children:[f,n&&c&&i.jsx("div",{role:"presentation",onPointerDown:p=>s(p,e),style:{position:"absolute",right:-5,bottom:-5,width:14,height:14,borderRadius:3,background:"var(--primary)",border:"2px solid var(--card)",cursor:"nwse-resize",touchAction:"none",zIndex:2}})]});if(e.kind==="custom_image"){const f=oH(e,r),h=e.w??25,p=e.h??25;return i.jsxs("div",{onPointerDown:v=>a(v,e),onClick:v=>v.stopPropagation(),style:{position:"absolute",left:`${e.x}%`,top:`${e.y}%`,width:`${h}%`,height:`${p}%`,border:l,borderRadius:4,cursor:"grab",boxSizing:"border-box",touchAction:"none",overflow:"hidden",background:"#fff"},children:[f?i.jsx("img",{src:f,alt:"",draggable:!1,style:{width:"100%",height:"100%",objectFit:"contain",pointerEvents:"none"}}):i.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(jx,{size:18,style:{color:"var(--muted)"}})}),n&&c&&i.jsx("div",{role:"presentation",onPointerDown:v=>s(v,e),style:{position:"absolute",right:-5,bottom:-5,width:14,height:14,borderRadius:3,background:"var(--primary)",border:"2px solid var(--card)",cursor:"nwse-resize",touchAction:"none",zIndex:2}})]})}if(e.field==="photo"){const f=Tse(t.name),h=Pse(t.name);return d(i.jsx("div",{style:{width:"100%",height:"100%",borderRadius:"50%",background:h,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-inter)",fontWeight:600,fontSize:"clamp(10px, 42%, 22px)",pointerEvents:"none"},children:f}))}return e.field==="qr"?d(i.jsx("div",{style:{width:"100%",height:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",borderRadius:4},children:o?i.jsx("img",{src:o,alt:"",draggable:!1,style:{width:"100%",height:"100%",objectFit:"contain",pointerEvents:"none"}}):i.jsx("span",{style:{fontSize:8,color:"var(--muted)"},children:"QR"})}),{borderRadius:4,overflow:"hidden"}):pS(e)?i.jsx(Rse,{el:e,sample:t,selected:n,border:l,onDragStart:a}):null}function Rse({el:e,sample:t,selected:r,border:n,onDragStart:o}){const a=S.useRef(null),[s,l]=$e.useState(e.fontSizePct??5),c=Ise(e,t),u=Pb(e),d=gse(e),f=e.fontSizePct??5,h=u?100:e.w??72;return S.useEffect(()=>{l(f)},[f,c,u,h,d,e.shrinkToFit]),S.useEffect(()=>{const p=a.current,v=p==null?void 0:p.parentElement;if(!p||!v)return;if(!G0(e)){l(f);return}let m=f;const b=w=>{p.style.fontSize=`calc(${w} * 1cqh)`};b(m);const x=()=>p.scrollWidth<=v.clientWidth+1;if(x()){l(m);return}for(let w=0;w<32&&m>1.5&&(m-=.25,b(m),!x());w+=1);l(m)},[e,c,f,h,u,d]),i.jsx("div",{onPointerDown:p=>o(p,e),onClick:p=>p.stopPropagation(),style:{position:"absolute",left:u?0:`${e.x}%`,top:`${e.y}%`,width:`${h}%`,border:n,borderRadius:2,padding:"2px 4px",cursor:"grab",boxSizing:"border-box",textAlign:d,touchAction:"none"},children:i.jsx("div",{ref:a,style:{fontFamily:Ese(e.fontFamily),fontSize:`calc(${s} * 1cqh)`,fontWeight:e.fontWeight==="bold"?700:400,color:e.color??"#0f172a",lineHeight:1.15,whiteSpace:G0(e)?"nowrap":"normal",wordBreak:G0(e)?"normal":"break-word",overflow:G0(e)?"hidden":"visible",display:"block",width:"100%",pointerEvents:"none"},children:e.field==="badge_type"?i.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:4,background:"rgba(15,23,42,0.12)"},children:c}):c})})}function Lse(e,t,r,n){return Sse(e,t,r,n)}const Fse=[3,3.5,4,4.5,5,6,7,8,9,10],aH={position:"absolute",left:"calc(100% + 12px)",top:36,width:240,zIndex:10,padding:14,borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",boxShadow:"0 8px 28px rgba(0,0,0,0.15)",display:"flex",flexDirection:"column",gap:10,maxHeight:"calc(100vh - 120px)",overflowY:"auto"};function zse({element:e,customTextValue:t,customImages:r,badgeAspectRatio:n,onChange:o,onRemoveCustom:a,onCustomImageUploaded:s}){return e?pS(e)?i.jsx(Mse,{element:e,customTextValue:t,onChange:o,onRemoveCustom:a}):JU(e)?i.jsx(Dse,{element:e,customImages:r,badgeAspectRatio:n,onChange:o,onRemoveCustom:a,onCustomImageUploaded:s}):null:null}function Mse({element:e,customTextValue:t,onChange:r,onRemoveCustom:n}){const o=Pb(e),a=s=>{r(s?{fullWidthCenter:!0,x:0,w:100,textAlign:e.textAlign??"center"}:{fullWidthCenter:!1,x:e.x>0?e.x:6,w:72,textAlign:e.textAlign==="center"?"left":e.textAlign??"left"})};return i.jsxs("div",{role:"dialog","aria-label":"Selected field styling",onClick:s=>s.stopPropagation(),style:aH,children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Selected field styling"}),e.kind==="custom_text"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Text"}),i.jsx("input",{style:{...Ht,marginTop:4},value:e.text??t??"",onChange:s=>r({text:s.target.value}),onFocus:St,onBlur:jt})]}),n&&i.jsxs("button",{type:"button",onClick:n,style:sH,children:[i.jsx(Xr,{size:12})," Remove fixed text"]})]}),i.jsxs("label",{style:tR,children:[i.jsx("input",{type:"checkbox",checked:o,onChange:s=>a(s.target.checked),style:{marginTop:3}}),i.jsx("span",{children:"Full width & center text"})]}),i.jsxs("label",{style:tR,children:[i.jsx("input",{type:"checkbox",checked:e.shrinkToFit!==!1,onChange:s=>r({shrinkToFit:s.target.checked}),style:{marginTop:3}}),i.jsx("span",{children:"Shrink font if text overflows badge"})]}),i.jsxs("div",{children:[i.jsx(ht,{text:"Align"}),i.jsx(Hi,{name:"textAlign",value:e.textAlign??(o?"center":"left"),onChange:s=>r({textAlign:s}),options:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"}]})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[i.jsx("input",{type:"color",value:e.color??"#0f172a",onChange:s=>r({color:s.target.value}),style:{width:40,height:32,border:"none",cursor:"pointer"}}),i.jsx("input",{style:{...Ht,flex:1},value:e.color??"#0f172a",onChange:s=>r({color:s.target.value}),onFocus:St,onBlur:jt})]})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font family"}),i.jsx(Zr,{children:i.jsx("select",{style:{...Tr,marginTop:4},value:e.fontFamily??"Inter",onChange:s=>r({fontFamily:s.target.value}),onFocus:St,onBlur:jt,children:B3.map(s=>i.jsx("option",{value:s.id,children:s.label},s.id))})})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font size"}),i.jsx(Zr,{children:i.jsx("select",{style:{...Tr,marginTop:4},value:String(e.fontSizePct??5),onChange:s=>r({fontSizePct:parseFloat(s.target.value)}),onFocus:St,onBlur:jt,children:Fse.map(s=>i.jsxs("option",{value:String(s),children:[s,"%"]},s))})})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Weight"}),i.jsx(Hi,{name:"fontWeight",value:e.fontWeight??"normal",onChange:s=>r({fontWeight:s}),options:[{label:"Normal",value:"normal"},{label:"Bold",value:"bold"}]})]}),i.jsx(Vt,{text:"Drag the field on the preview to move it."})]})}function Dse({element:e,customImages:t,badgeAspectRatio:r,onChange:n,onRemoveCustom:o,onCustomImageUploaded:a}){const s=S.useRef(null),[l,c]=S.useState(!1),u=e.w??28,d=e.field==="qr"?"QR code":e.field==="photo"?"Photo":"Fixed image",f=v=>{n(MT(e,v,r))},h=async v=>{if(!(!(v!=null&&v.type.startsWith("image/"))||e.kind!=="custom_image")){c(!0);try{const m=await eH(v),b=await Sa(v,{eventId:"portfolio",module:"badges/fixed-images"});if(b.url){const x=e.w??25,w=Rm(x,m,r);n({imageUrl:b.url,imageAspectRatio:m,h:w}),a==null||a(e.id,b.url,m)}}finally{c(!1)}}},p=e.kind==="custom_image"?oH(e,t):"";return i.jsxs("div",{role:"dialog","aria-label":"Selected element styling",onClick:v=>v.stopPropagation(),style:aH,children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:d}),e.kind==="custom_image"&&i.jsxs(i.Fragment,{children:[p?i.jsx("img",{src:p,alt:"",style:{maxWidth:"100%",maxHeight:80,objectFit:"contain",borderRadius:4,border:"1px solid var(--border)"}}):null,i.jsx("input",{ref:s,type:"file",accept:"image/*",style:{display:"none"},disabled:l,onChange:v=>{var m;h((m=v.target.files)==null?void 0:m[0]),v.target.value=""}}),i.jsxs("button",{type:"button",disabled:l,onClick:()=>{var v;return(v=s.current)==null?void 0:v.click()},style:Bse,children:[i.jsx(Fl,{size:14}),l?"Uploading…":p?"Replace image":"Upload image"]}),o&&i.jsxs("button",{type:"button",onClick:o,style:sH,children:[i.jsx(Xr,{size:12})," Remove fixed image"]})]}),i.jsxs("div",{children:[i.jsx(ht,{text:"Size"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:6},children:[i.jsx("input",{type:"range",min:BT,max:WT,step:1,value:u,onChange:v=>f(parseFloat(v.target.value)),style:{flex:1}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",minWidth:36},children:[Math.round(u),"%"]})]})]}),i.jsx(Vt,{text:"Drag to move. Use the blue corner handle on the preview or the slider above to resize."})]})}const tR={display:"flex",alignItems:"flex-start",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},sH={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-xs)",alignSelf:"flex-start"},Bse={display:"inline-flex",alignItems:"center",gap:8,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)"};function Wse(e){const t=e.event;return typeof t=="string"?t:t&&typeof t=="object"&&"_id"in t?String(t._id):""}function qse(e){const r=`Copy of ${(e||"Badge export").trim()}`;return r.length>120?`${r.slice(0,117)}…`:r}function $se(e){return e.config&&typeof e.config=="object"?e.config:{}}function Kc(e,t=""){return typeof e=="string"?e:t}function rR(e,t){return typeof e=="boolean"?e:t}function nR(e,t){return typeof e=="number"&&Number.isFinite(e)?String(e):t}function Use(e){const t=Kc(e.sizePreset,"a6");return t==="a7"||t==="4x3in"||t==="4x6in"||t==="custom"?t:"a6"}function Hse(e){const t=e.layout;return!Array.isArray(t)||t.length===0?[]:t.filter(r=>r!=null&&typeof r=="object"&&typeof r.id=="string").map(r=>({...r}))}function Vse(e,t){const r=Array.isArray(e.customTexts)?e.customTexts.filter(n=>n!=null&&typeof n=="object"&&typeof n.id=="string").map(n=>({id:String(n.id),text:String(n.text??"")})):[];return r.length?r:t.filter(n=>n.kind==="custom_text").map(n=>({id:n.id,text:Kc(n.text,"Your text")}))}function Yse(e,t){const r=Array.isArray(e.customImages)?e.customImages.filter(n=>n!=null&&typeof n=="object"&&typeof n.id=="string").map(n=>({id:String(n.id),imageUrl:String(n.imageUrl??"")})):[];return r.length?r:t.filter(n=>n.kind==="custom_image").map(n=>({id:n.id,imageUrl:Kc(n.imageUrl,"")})).filter(n=>n.imageUrl)}function Gse(e){const t=$se(e),r=Kc(t.backgroundMode,"color")==="image"?"image":"color",n=Kc(t.backgroundColor,"#0B4DD1"),o=Array.isArray(t.fields)?t.fields.map(f=>String(f)):["name","title","org","qr"];let a=Hse(t);!a.length&&o.length&&(a=nH(o,n,r));const s=Vse(t,a),l=Yse(t,a),c=Kc(t.participantScope,"all")==="participant_list"?"participant_list":"all",u=Kc(t.outputFormat,"pdf"),d=u==="png"||u==="jpeg"?u:"pdf";return{formName:qse(e.name),formEventId:Wse(e),sizePreset:Use(t),customW:nR(t.widthMm,"105"),customH:nR(t.heightMm,"148"),orientation:Kc(t.orientation,"portrait")==="landscape"?"landscape":"portrait",includeFaculty:rR(t.includeFaculty,!0),includeParticipants:rR(t.includeParticipants,!0),participantScope:c,participantListId:t.participantListId!=null?String(t.participantListId):"",backgroundMode:r,backgroundColor:n,backgroundImageUrl:Kc(t.backgroundImageUrl,""),enabledFields:o,layoutElements:a,customTexts:s,customImages:l,outputFormat:d,badgeTypeLabel:Kc(t.badgeTypeLabel,"Attendee")}}const Kse=[{id:"a6",label:"A6 (105 × 148 mm)"},{id:"a7",label:"A7 (74 × 105 mm)"},{id:"4x3in",label:"4 × 3 in"},{id:"4x6in",label:"4 × 6 in"},{id:"custom",label:"Custom (mm)"}],Qse=[{id:"name",icon:i.jsx(Om,{size:13}),label:"Full name"},{id:"title",icon:i.jsx(ore,{size:13}),label:"Title / role"},{id:"org",icon:i.jsx(_b,{size:13}),label:"Organisation"},{id:"badge_type",icon:i.jsx(bi,{size:13}),label:"Badge type tag"},{id:"qr",icon:i.jsx(Zf,{size:13}),label:"QR code"},{id:"photo",icon:i.jsx(Om,{size:13}),label:"Photo (faculty)"}];function Xse({busy:e,disabled:t,onFile:r}){const n=S.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},disabled:e||t,onChange:o=>{var s;const a=(s=o.target.files)==null?void 0:s[0];a&&r(a),o.target.value=""}}),i.jsxs("button",{type:"button",disabled:e||t,onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:e||t?"not-allowed":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:e||t?.6:1},children:[i.jsx(gr,{size:12})," ",e?"Uploading…":"Add fixed image"]})]})}function Zse({busy:e,disabled:t,onFile:r}){const n=S.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},disabled:e||t,onChange:o=>{var a;r((a=o.target.files)==null?void 0:a[0]),o.target.value=""}}),i.jsxs("button",{type:"button",disabled:e||t,onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,padding:"8px 14px",borderRadius:"var(--radius-button)",background:e?"var(--secondary)":"var(--primary)",color:e?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:e||t?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Fl,{size:14}),e?"Uploading…":"Choose file"]})]})}function lH({onClose:e,onSuccess:t,duplicateFromBatchId:r,initialEventId:n}){var Tt;const{user:o}=Mr(),a=Nn(o),s=3,l=wc(s),[c,u]=S.useState([]),[d,f]=S.useState([]),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState("a6"),[w,k]=S.useState("105"),[j,_]=S.useState("148"),[T,A]=S.useState("portrait"),[P,N]=S.useState(!0),[O,C]=S.useState(!0),[I,R]=S.useState("all"),[F,M]=S.useState(""),[Y,X]=S.useState("color"),[$,ee]=S.useState("#0B4DD1"),[V,D]=S.useState(""),[z,q]=S.useState(""),[G,U]=S.useState(["name","title","org","qr"]),[Q,K]=S.useState(()=>nH(["name","title","org","qr"],"#0B4DD1","color")),[re,H]=S.useState([]),[ie,de]=S.useState([]),[le,ke]=S.useState(!1),[ve,se]=S.useState(null),[be,De]=S.useState("Attendee"),[ae,ue]=S.useState("pdf"),[Me,Se]=S.useState(!1),[Pe,Ee]=S.useState(null),[Ae,Ye]=S.useState(""),[rt,He]=S.useState(!1),[xt,st]=S.useState(!!r),Te=Lse(b,T,w,j),et=!!r,Pt=z||V,qe=S.useMemo(()=>Q.find(We=>We.id===ve)??null,[Q,ve]);S.useEffect(()=>()=>{z.startsWith("blob:")&&URL.revokeObjectURL(z)},[z]),S.useEffect(()=>{K(We=>We.map(ce=>{let he={...ce};if(ce.field==="qr"){const je=ce.w??28;he={...he,w:je,h:je}}else if(ce.field==="photo"&&ce.w!=null)he={...he,h:ce.w};else if(ce.kind==="custom_image"&&ce.imageAspectRatio){const je=ce.w??25;he={...he,h:Rm(je,ce.imageAspectRatio,Te)}}return{...he,...DT(he,he.x,he.y)}}))},[b,T,w,j,Te]),S.useEffect(()=>{if(!r||!a){st(!1);return}let We=!1;return st(!0),Ye(""),wx.get(r,a).then(ce=>{if(We)return;if(ce.error||!ce.data){Ye(typeof ce.error=="string"?ce.error:"Could not load badge to duplicate."),st(!1);return}const he=Gse(ce.data);p(he.formName),m(he.formEventId),x(he.sizePreset),k(he.customW),_(he.customH),A(he.orientation),N(he.includeFaculty),C(he.includeParticipants),R(he.participantScope),M(he.participantListId),X(he.backgroundMode),ee(he.backgroundColor),D(he.backgroundImageUrl),q(""),U(he.enabledFields),K(he.layoutElements),H(he.customTexts),de(he.customImages),ue(he.outputFormat),De(he.badgeTypeLabel),se(null),st(!1)}),()=>{We=!0}},[r,a]),S.useEffect(()=>{n&&m(n)},[n]),S.useEffect(()=>{a&&(Lr.list({limit:100,organization:a}).then(We=>{var ce;(ce=We.data)!=null&&ce.events&&(u(We.data.events),m(he=>{var je;return he||n||((je=We.data.events[0])==null?void 0:je._id)||""}))}),qa.list({organization:a}).then(We=>{var ce;(ce=We.data)!=null&&ce.lists&&(f(We.data.lists),M(he=>{var je;return he||((je=We.data.lists[0])==null?void 0:je._id)||""}))}))},[a,n]);const Et=We=>{const ce=G.includes(We)?G.filter(he=>he!==We):[...G,We];U(ce),K(he=>eR(he,ce,re,ie,$,Y,Te)),!ce.includes(We)&&ve===We&&se(null)},vt=()=>{if(re.length>=xy)return;const We=_se(),he=[...re,{id:We,text:"Your text"}];H(he),K(je=>eR(je,G,he,ie,$,Y,Te)),se(We)},Ft=async We=>{if(ie.length>=Q5)return;if(!We.type.startsWith("image/")){Ye("Choose an image file.");return}const ce=Cse();ke(!0),Ye("");try{const he=await eH(We),je=await Sa(We,{eventId:"portfolio",module:"badges/fixed-images"});if(!je.url)throw new Error("Upload failed");const xe=[...ie,{id:ce,imageUrl:je.url}];de(xe),K(Re=>[...Re,iH(ce,je.url,ie.length,Te,he)]),se(ce)}catch(he){Ye(he instanceof Error?he.message:"Upload failed")}finally{ke(!1)}},Ce=We=>{de(ce=>ce.filter(he=>he.id!==We)),K(ce=>ce.filter(he=>he.id!==We)),ve===We&&se(null)},lt=We=>{H(ce=>ce.filter(he=>he.id!==We)),K(ce=>ce.filter(he=>he.id!==We)),ve===We&&se(null)},Xe=We=>{ve&&(K(ce=>ce.map(he=>{if(he.id!==ve)return he;const je={...he,...We};if(We.w!=null&&(he.field==="qr"||he.kind==="custom_image"||he.field==="photo"))return{...je,...MT(je,We.w,Te)};if(We.imageAspectRatio!=null&&he.kind==="custom_image"){const xe=je.w??25;return{...je,h:Rm(xe,We.imageAspectRatio,Te)}}return je})),We.text!==void 0&&(qe==null?void 0:qe.kind)==="custom_text"&&H(ce=>ce.map(he=>he.id===ve?{...he,text:We.text}:he)),We.imageUrl!==void 0&&(qe==null?void 0:qe.kind)==="custom_image"&&de(ce=>ce.map(he=>he.id===ve?{...he,imageUrl:We.imageUrl}:he)))},Be=async We=>{if(!We||!We.type.startsWith("image/")){Ye("Choose an image file.");return}const ce=URL.createObjectURL(We);q(ce),He(!0),Ye("");try{const he=await Sa(We,{eventId:"portfolio",module:"badges/backgrounds"});he.url&&(D(he.url),X("image"))}catch(he){Ye(he instanceof Error?he.message:"Upload failed")}finally{He(!1)}},ct=async()=>{var xe,Re;if(Ye(""),Ee(null),!a){Ye("No organisation context.");return}if(!h.trim()){Ye("Name is required.");return}if(!v){Ye("Select an event.");return}if(!P&&!O){Ye("Select Faculty and/or Participants.");return}if(O&&I==="participant_list"&&!F){Ye("Select a contact list.");return}if(Y==="image"&&!V.trim()){Ye("Upload a background image or switch to solid colour.");return}const We=Q.some(ze=>ze.kind==="custom_text")||Q.some(ze=>ze.kind==="custom_image");if(!G.length&&!We){Ye("Select at least one badge field, fixed text, or fixed image.");return}for(const ze of G)if(!Q.some(Le=>Le.kind==="field"&&Le.field===ze)){Ye(`Layout missing for field: ${ze}`);return}for(const ze of Q){if(ze.kind==="custom_text"&&!String(ze.text||((xe=re.find(Le=>Le.id===ze.id))==null?void 0:xe.text)||"").trim()){Ye("Fixed text fields must have content.");return}if(ze.kind==="custom_image"&&!(ze.imageUrl||((Re=ie.find(Qe=>Qe.id===ze.id))==null?void 0:Re.imageUrl)||"").trim()){Ye("Fixed image fields must have an uploaded image.");return}}if(b==="custom"){const ze=parseFloat(w),Le=parseFloat(j);if(!Number.isFinite(ze)||!Number.isFinite(Le)||ze<=0||Le<=0){Ye("Enter valid custom width and height (mm).");return}}const ce=Q.map(ze=>{var Le,Qe;return{...ze,text:ze.kind==="custom_text"?ze.text??((Le=re.find(mt=>mt.id===ze.id))==null?void 0:Le.text)??"":void 0,imageUrl:ze.kind==="custom_image"?ze.imageUrl??((Qe=ie.find(mt=>mt.id===ze.id))==null?void 0:Qe.imageUrl)??"":void 0}}),he={name:h.trim(),organization:a,event:v,sizePreset:b,...b==="custom"?{widthMm:parseFloat(w),heightMm:parseFloat(j)}:{},orientation:T,includeFaculty:P,includeParticipants:O,participantScope:I,...O&&I==="participant_list"?{participantListId:F}:{},backgroundMode:Y,backgroundImageUrl:Y==="image"?V.trim():"",backgroundColor:$,fields:G,layout:ce,customTexts:re.map(({id:ze,text:Le})=>({id:ze,text:Le})),customImages:ie.map(({id:ze,imageUrl:Le})=>({id:ze,imageUrl:Le})),outputFormat:ae,badgeTypeLabel:be.trim()||"Attendee"};Se(!0);const je=await wx.create(he);if(Se(!1),je.error){Ye(typeof je.error=="string"?je.error:"Request failed");return}Ee("We have received your request. Generation runs in the background — this page will refresh with a download link when ready (usually within a few minutes)."),t==null||t(),setTimeout(()=>e(),2500)};return i.jsxs(ra,{onClose:e,title:et?"Duplicate badge export":"Request badge export",breadcrumb:"Design · Badges",description:et?"Settings copied from the selected export. Adjust anything, then submit to queue a new batch.":"Faculty = speakers linked to sessions for the selected event. A zip file is built on the server and uploaded when ready.",completedCount:l.done.size,totalSections:s,ctaLabel:"Submit request",ctaDisabled:Me||xt,onCtaClick:ct,panelWidth:"min(1120px, 100vw)",children:[xt&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px"},children:"Loading badge settings…"}),i.jsxs("div",{style:{display:"flex",minHeight:"100%"},children:[i.jsx("div",{style:{flex:"0 0 42%",maxWidth:"42%",borderRight:"1px solid var(--border)",alignSelf:"flex-start",position:"sticky",top:0,overflow:"visible",zIndex:2},children:i.jsxs("div",{style:{position:"relative",overflow:"visible"},children:[i.jsx(Ose,{aspectRatio:Te,badgeAspectRatio:Te,backgroundMode:Y,backgroundColor:$,backgroundImageUrl:Pt,layoutElements:Q,customImages:ie,badgeTypeLabel:be,selectedId:ve,onSelect:se,onLayoutChange:K}),i.jsx(zse,{element:qe,customTextValue:(Tt=re.find(We=>We.id===ve))==null?void 0:Tt.text,customImages:ie,badgeAspectRatio:Te,onChange:Xe,onRemoveCustom:(qe==null?void 0:qe.kind)==="custom_text"?()=>lt(qe.id):(qe==null?void 0:qe.kind)==="custom_image"?()=>Ce(qe.id):void 0,onCustomImageUploaded:(We,ce,he)=>{de(je=>je.map(xe=>xe.id===We?{...xe,imageUrl:ce}:xe)),Xe({imageUrl:ce,imageAspectRatio:he})}})]})}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[Ae&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px"},children:Ae}),Pe&&i.jsx("p",{style:{color:"var(--foreground)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px",background:"var(--accent)",padding:12,borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:Pe}),i.jsxs(Ur,{n:1,title:"Details & recipients",subtitle:"Event, size, orientation, who appears on badges",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Design",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Export name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026 — All badges",value:h,onChange:We=>p(We.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Associated event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:v,onChange:We=>m(We.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select…"}),c.map(We=>i.jsx("option",{value:We._id,children:We.name},We._id))]})})]}),i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Badge size",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:b,onChange:We=>x(We.target.value),onFocus:St,onBlur:jt,children:Kse.map(We=>i.jsx("option",{value:We.id,children:We.label},We.id))})})]}),b==="custom"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Width (mm)",required:!0}),i.jsx("input",{style:Ht,value:w,onChange:We=>k(We.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Height (mm)",required:!0}),i.jsx("input",{style:Ht,value:j,onChange:We=>_(We.target.value),onFocus:St,onBlur:jt})]})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Orientation"}),i.jsx(Hi,{name:"bdOrientation",value:T,onChange:We=>A(We),options:[{label:"Portrait",value:"portrait"},{label:"Landscape",value:"landscape"}]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Include on export",required:!0}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:P,onChange:We=>N(We.target.checked)}),"Faculty (speakers linked to this event's sessions)"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:O,onChange:We=>C(We.target.checked)}),"Participants"]})]})]}),O&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Participants"}),i.jsx(Hi,{name:"partScope",value:I,onChange:We=>R(We),options:[{label:"All registered for this event",value:"all"},{label:"Specific contact list",value:"participant_list"}]}),I==="participant_list"&&i.jsx(Zr,{children:i.jsxs("select",{style:{...Tr,marginTop:8},value:F,onChange:We=>M(We.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select list…"}),d.map(We=>i.jsx("option",{value:We._id,children:We.name},We._id))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Badge type label (participants)"}),i.jsx("input",{style:Ht,value:be,onChange:We=>De(We.target.value),placeholder:"Attendee",onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Shown when “Badge type tag” is enabled; faculty use their speaker role when available."})]})]}),i.jsxs(Ur,{n:2,title:"Design",subtitle:"Background and fields on the badge",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Output",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Background",required:!0}),i.jsx(Hi,{name:"bgMode",value:Y,onChange:We=>X(We),options:[{label:"Solid colour",value:"color"},{label:"Image",value:"image"}]})]}),Y==="color"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("input",{type:"color",value:$,onChange:We=>ee(We.target.value),style:{width:48,height:36,border:"none",cursor:"pointer"}}),i.jsx("input",{style:{...Ht,flex:1},value:$,onChange:We=>ee(We.target.value),onFocus:St,onBlur:jt})]})]}),Y==="image"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Background image"}),i.jsx("input",{style:Ht,value:V,onChange:We=>D(We.target.value),placeholder:"https://… or upload",onFocus:St,onBlur:jt}),i.jsx(Zse,{busy:rt,onFile:We=>void Be(We)}),i.jsx(Vt,{text:"Must be reachable by the server when the worker runs (public HTTPS)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Badge fields"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Qse.map(We=>{const ce=G.includes(We.id);return i.jsxs("button",{type:"button",onClick:()=>Et(We.id),style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${ce?"var(--primary)":"var(--border)"}`,background:ce?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left"},children:[i.jsx("span",{style:{color:"var(--muted)"},children:We.icon}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:We.label})]},We.id)})})]}),i.jsxs(dt,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(ht,{text:"Fixed text fields"}),i.jsxs("button",{type:"button",disabled:re.length>=xy,onClick:vt,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:re.length>=xy?"not-allowed":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:re.length>=xy?.6:1},children:[i.jsx(gr,{size:12})," Add fixed text"]})]}),i.jsx(Vt,{text:`Up to ${xy} custom labels. Click a field on the preview to style it in the panel beside the preview.`})]}),i.jsxs(dt,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(ht,{text:"Fixed images"}),i.jsx(Xse,{busy:le,disabled:ie.length>=Q5,onFile:We=>void Ft(We)})]}),i.jsx(Vt,{text:`Up to ${Q5} logos or graphics. Keeps the uploaded width/height ratio — drag and resize on preview.`})]})]}),i.jsxs(Ur,{n:3,title:"Output format",subtitle:"Files are zipped after generation",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>l.advance(3),nextLabel:"Submit",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Format",required:!0}),i.jsx(Hi,{name:"outFmt",value:ae,onChange:We=>ue(We),options:[{label:"PDF (multi-page, one badge per page)",value:"pdf"},{label:"PNG (one file per person)",value:"png"},{label:"JPEG (one file per person)",value:"jpeg"}]})]}),i.jsx(Vt,{text:"Run npm run badge-batch-worker on the server so jobs complete. AWS S3/CloudFront must be configured."})]})]})]})]})}function Jse(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function ele(e){return e==="ready"?"Ready":e==="processing"?"Processing":e==="failed"?"Failed":"Pending"}function tle({eventId:e,eventName:t,onClose:r,onAddBadge:n,onDuplicateBadge:o}){const{user:a}=Mr(),s=!!(a&&["super_admin","admin","moderator"].includes(a.role)),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(""),p=S.useCallback(async()=>{var v;d(!0),h("");try{const m=await wx.list({event:e,limit:100});m.error?(h(typeof m.error=="string"?m.error:"Failed to load badges."),c([])):c(((v=m.data)==null?void 0:v.batches)??[])}catch{h("Failed to load badges."),c([])}finally{d(!1)}},[e]);return S.useEffect(()=>{p()},[p]),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":"event-badges-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)"},children:[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:"Tag & Badge Configuration"}),i.jsx("h2",{id:"event-badges-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:t?`Badges · ${t}`:"Badges"})]}),i.jsxs("div",{style:{display:"flex",gap:8,flexShrink:0},children:[s?i.jsxs("button",{type:"button",onClick:n,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(gr,{size:14})," Add Badge"]}):null,i.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{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(Gt,{size:18})})]})]}),i.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px 18px"},children:[u?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading badges…"}):null,f?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:f}):null,!u&&!f&&l.length===0?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"48px 24px",gap:12},children:[i.jsx(Cx,{size:36,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"No badges yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:320,lineHeight:1.5},children:"Create a badge export to design attendee and speaker badges for this event."}),s?i.jsxs("button",{type:"button",onClick:n,style:{display:"inline-flex",alignItems:"center",gap:6,marginTop:8,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:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(gr,{size:14})," Add Badge"]}):null]}):null,!u&&!f&&l.length>0?i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:l.map(v=>i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",flexDirection:"column",gap:8},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx(Cx,{size:18,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:v.name})]}),i.jsxs("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Status: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:ele(v.status)}),v.itemCount!=null?` · ${v.itemCount} badge${v.itemCount!==1?"s":""}`:""]}),v.lastError&&v.status==="failed"?i.jsx("span",{style:{fontSize:"10px",color:"var(--destructive)"},children:v.lastError}):null,i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[s?i.jsxs("button",{type:"button",title:"Duplicate — copy settings and edit",onClick:()=>o(v._id),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(Js,{size:13})," Duplicate"]}):null,v.status==="ready"&&v.zipUrl?i.jsxs("a",{href:v.zipUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",textDecoration:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ja,{size:13})," Download zip"]}):i.jsxs("button",{type:"button",disabled:!0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--muted)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"not-allowed"},children:[i.jsx(ja,{size:13})," Download zip"]})]}),v.createdAt?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Requested ",Jse(v.createdAt)]}):null]},v._id))}):null]})]})]})}const by={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"},Op={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px",display:"block"},K0=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),rle=["Single Choice","Multiple Choice","True / False"];function nle(e){return!!(e.text.trim()||e.imageUrl)}function iR({onSave:e,onClose:t,initial:r,eventId:n,showPerQuestionTimeLimit:o}){const[a,s]=S.useState((r==null?void 0:r.text)??""),[l,c]=S.useState((r==null?void 0:r.type)??"Single Choice"),[u,d]=S.useState((r==null?void 0:r.order)??0),[f,h]=S.useState((r==null?void 0:r.status)??"Active"),[p,v]=S.useState((r==null?void 0:r.imageUrl)??""),[m,b]=S.useState(typeof(r==null?void 0:r.timeLimit)=="number"&&Number.isFinite(r.timeLimit)?r.timeLimit:0),[x,w]=S.useState((r==null?void 0:r.options)??[{id:"o1",text:"",isCorrect:!1},{id:"o2",text:"",isCorrect:!1}]),[k,j]=S.useState(()=>{var D;return(r==null?void 0:r.useImagesOptions)??((D=r==null?void 0:r.options)==null?void 0:D.some(z=>z.imageUrl))??!1}),[_,T]=S.useState({}),[A,P]=S.useState(null),[N,O]=S.useState(null),C=S.useRef(null),I=()=>w(D=>[...D,{id:`o${Date.now()}`,text:"",isCorrect:!1}]),R=D=>w(z=>z.filter(q=>q.id!==D)),F=(D,z,q)=>w(G=>G.map(U=>U.id!==D?U:z==="isCorrect"&&q===!0&&l==="Single Choice"?{...U,isCorrect:!0}:{...U,[z]:q}).map(U=>z==="isCorrect"&&q===!0&&l==="Single Choice"&&U.id!==D?{...U,isCorrect:!1}:U)),M=async(D,z)=>{O(null),P(z);try{const q=await Sa(D,{eventId:n,module:"quiz-polls"});q!=null&&q.url&&(z==="question"?v(q.url):F(z,"imageUrl",q.url))}catch(q){O(q instanceof Error?q.message:"Upload failed")}finally{P(null)}},Y=D=>{var q;const z=(q=D.target.files)==null?void 0:q[0];D.target.value="",z&&M(z,"question")},X=(D,z)=>{var G;const q=(G=z.target.files)==null?void 0:G[0];z.target.value="",q&&M(q,D)},$=()=>{const D={};if(a.trim()||(D.text="Question text is required."),x.filter(nle).length<2&&(D.options="At least 2 options with text and/or image are required."),o){const q=Math.floor(Number(m));(!Number.isFinite(q)||q<=0)&&(D.timeLimit="Time limit must be greater than 0 seconds.")}return T(D),Object.keys(D).length===0},ee=()=>{$()&&(e({id:(r==null?void 0:r.id)??`q${Date.now()}`,text:a.trim(),type:l,order:u,status:f,options:x,imageUrl:p.trim()||void 0,useImagesOptions:k,...o?{timeLimit:Math.max(0,Math.floor(Number(m))||0)}:{}}),t())},V=A==="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(Gt,{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:Op,children:["Question ",K0]}),i.jsx("textarea",{value:a,onChange:D=>{s(D.target.value),_.text&&T(z=>({...z,text:""}))},rows:3,placeholder:"Enter your question…",style:{...by,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5",borderColor:_.text?"var(--destructive)":"var(--border)"},onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor=_.text?"var(--destructive)":"var(--border)"}}),_.text&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"4px"},children:_.text})]}),i.jsxs("div",{children:[i.jsx("label",{style:Op,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:V?"var(--border)":"var(--secondary)",cursor:V?"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(jx,{size:13,style:{color:"var(--muted)"}}),V?"Uploading…":"Choose File",i.jsx("input",{ref:C,type:"file",accept:"image/*",disabled:!!V,onChange:Y,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:p?"Image attached":"No file chosen"}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{padding:"0 10px",height:"36px",border:"none",background:"transparent",color:"var(--destructive)",fontSize:"var(--text-xs)",cursor:"pointer",flexShrink:0},children:"Remove"})]}),p&&i.jsx("img",{src:p,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)"}),N&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginTop:"4px"},children:N})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:Op,children:["Question Type ",K0]}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("select",{value:l,onChange:D=>c(D.target.value),style:{...by,appearance:"none",paddingRight:"28px",cursor:"pointer"},children:rle.map(D=>i.jsx("option",{value:D,children:D},D))}),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:Op,children:"Order"}),i.jsx("input",{type:"number",min:0,value:u,onChange:D=>d(Number(D.target.value)),style:by,onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor="var(--border)"}})]})]}),o?i.jsxs("div",{children:[i.jsxs("label",{style:Op,children:["Time Limit (seconds)",K0]}),i.jsx("input",{type:"number",min:1,value:m,onChange:D=>{b(Number(D.target.value)),_.timeLimit&&T(z=>({...z,timeLimit:""}))},style:{...by,borderColor:_.timeLimit?"var(--destructive)":"var(--border)"},onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor=_.timeLimit?"var(--destructive)":"var(--border)"}}),_.timeLimit?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"4px"},children:_.timeLimit}):i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"How long attendees have to answer this question in Quiz Master mode."})]}):null,i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[i.jsxs("label",{style:{...Op,marginBottom:0},children:["Options ",K0]}),i.jsxs("button",{type:"button",onClick:()=>j(D=>!D),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:k?"var(--primary)":"var(--border)",display:"block",flexShrink:0}}),"Use Images in Options"]})]}),_.options&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"6px"},children:_.options}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:x.map((D,z)=>i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",padding:k?"10px":"0",border:k?"1px solid var(--border)":"none",borderRadius:"var(--radius-button)",background:k?"var(--secondary)":"transparent"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("input",{type:"text",placeholder:k?`Label / alt text (option ${z+1})`:`Enter option ${z+1}`,value:D.text,onChange:q=>F(D.id,"text",q.target.value),style:{...by,flex:1},onFocus:q=>{q.currentTarget.style.borderColor="var(--ring)"},onBlur:q=>{q.currentTarget.style.borderColor="var(--border)"}}),i.jsxs("button",{type:"button",onClick:()=>F(D.id,"isCorrect",!D.isCorrect),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 10px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${D.isCorrect?"#16a34a":"var(--border)"}`,background:D.isCorrect?"#f0fdf4":"var(--card)",color:D.isCorrect?"#15803d":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:D.isCorrect?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",whiteSpace:"nowrap",flexShrink:0},children:[D.isCorrect&&i.jsx(bi,{size:11,strokeWidth:2.5}),"Correct"]}),i.jsx("button",{type:"button",onClick:()=>x.length>2&&R(D.id),disabled:x.length<=2,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"none",background:x.length<=2?"var(--border)":"var(--destructive)",color:"#fff",cursor:x.length<=2?"not-allowed":"pointer",flexShrink:0},children:i.jsx(Xr,{size:13})})]}),k&&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:A===D.id?"var(--border)":"var(--card)",cursor:A===D.id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(jx,{size:12}),A===D.id?"Uploading…":"Option image",i.jsx("input",{type:"file",accept:"image/*",disabled:A===D.id,onChange:q=>X(D.id,q),style:{display:"none"}})]}),D.imageUrl&&i.jsxs(i.Fragment,{children:[i.jsx("img",{src:D.imageUrl,alt:"",style:{width:"48px",height:"48px",objectFit:"cover",borderRadius:"6px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>F(D.id,"imageUrl",""),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove image"})]})]})]},D.id))}),i.jsxs("button",{type:"button",onClick:I,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(gr,{size:13})," Add Option"]})]}),i.jsxs("div",{children:[i.jsx("label",{style:Op,children:"Status"}),i.jsx("div",{style:{display:"flex",gap:"8px"},children:["Active","Draft"].map(D=>i.jsx("button",{type:"button",onClick:()=>h(D),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",border:`1px solid ${f===D?"var(--primary)":"var(--border)"}`,background:f===D?"var(--accent)":"var(--card)",color:f===D?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:f===D?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer"},children:D},D))})]})]}),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:ee,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"})]})]})})}function ile(e){return e.displayMode==="quiz_master"&&e.timeRestricted==="Yes"}function ole(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",timeLimit:typeof t.timeLimit=="number"&&Number.isFinite(t.timeLimit)?Math.max(0,Math.floor(t.timeLimit)):void 0}}):[]}function hS(e,t){var n,o;const r={question:e.text,imageUrl:(n=e.imageUrl)!=null&&n.trim()?e.imageUrl.trim():null,type:e.type==="Single Choice"||e.type==="True / False"?"single":e.type==="Multiple Choice"?"multiple":"text",options:(o=e.options)==null?void 0:o.map(a=>{var s;return{text:a.text,isCorrect:a.isCorrect,imageUrl:(s=a.imageUrl)!=null&&s.trim()?a.imageUrl.trim():null}}),required:!0,...t==="quiz"?{points:1}:{}};return typeof e.timeLimit=="number"&&Number.isFinite(e.timeLimit)&&e.timeLimit>0?{...r,timeLimit:Math.max(0,Math.floor(e.timeLimit))}:r}var X5=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],hm={_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},Ex={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},ls=function(e,t){return t===void 0&&(t=2),("000"+e).slice(t*-1)},Al=function(e){return e===!0?1:0};function oR(e,t){var r;return function(){var n=this,o=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(n,o)},t)}}var Z5=function(e){return e instanceof Array?e:[e]};function La(e,t,r){if(r===!0)return e.classList.add(t);e.classList.remove(t)}function hn(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 Q0(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function cH(e,t){if(t(e))return e;if(e.parentNode)return cH(e.parentNode,t)}function X0(e,t){var r=hn("div","numInputWrapper"),n=hn("input","numInput "+e),o=hn("span","arrowUp"),a=hn("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 Fs(e){try{if(typeof e.composedPath=="function"){var t=e.composedPath();return t[0]}return e.target}catch{return e.target}}var J5=function(){},p2=function(e,t,r){return r.months[t?"shorthand":"longhand"][e]},ale={D:J5,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*Al(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:J5,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:J5,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},ih={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})"},rx={Z:function(e){return e.toISOString()},D:function(e,t,r){return t.weekdays.shorthand[rx.w(e,t,r)]},F:function(e,t,r){return p2(rx.n(e,t,r)-1,!1,t)},G:function(e,t,r){return ls(rx.h(e,t,r))},H:function(e){return ls(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[Al(e.getHours()>11)]},M:function(e,t){return p2(e.getMonth(),!0,t)},S:function(e){return ls(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,r){return r.getWeek(e)},Y:function(e){return ls(e.getFullYear(),4)},d:function(e){return ls(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return ls(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return ls(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)}},uH=function(e){var t=e.config,r=t===void 0?hm:t,n=e.l10n,o=n===void 0?Ex: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 rx[f]&&p[h-1]!=="\\"?rx[f](l,d,r):f!=="\\"?f:""}).join("")}},W3=function(e){var t=e.config,r=t===void 0?hm:t,n=e.l10n,o=n===void 0?Ex: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||hm).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 v=void 0,m=[],b=0,x=0,w="";bMath.min(t,r)&&e=0?new Date:new Date(r.config.minDate.getTime()),je=tk(r.config);he.setHours(je.hours,je.minutes,je.seconds,he.getMilliseconds()),r.selectedDates=[he],r.latestSelectedDateObj=he}ce!==void 0&&ce.type!=="blur"&&We(ce);var xe=r._input.value;f(),ct(),r._input.value!==xe&&r._debouncedChange()}function u(ce,he){return ce%12+12*Al(he===r.l10n.amPM[1])}function d(ce){switch(ce%24){case 0:case 12:return 12;default:return ce%12}}function f(){if(!(r.hourElement===void 0||r.minuteElement===void 0)){var ce=(parseInt(r.hourElement.value.slice(-2),10)||0)%24,he=(parseInt(r.minuteElement.value,10)||0)%60,je=r.secondElement!==void 0?(parseInt(r.secondElement.value,10)||0)%60:0;r.amPM!==void 0&&(ce=u(ce,r.amPM.textContent));var xe=r.config.minTime!==void 0||r.config.minDate&&r.minDateHasTime&&r.latestSelectedDateObj&&Ds(r.latestSelectedDateObj,r.config.minDate,!0)===0,Re=r.config.maxTime!==void 0||r.config.maxDate&&r.maxDateHasTime&&r.latestSelectedDateObj&&Ds(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 ze=ek(r.config.minTime.getHours(),r.config.minTime.getMinutes(),r.config.minTime.getSeconds()),Le=ek(r.config.maxTime.getHours(),r.config.maxTime.getMinutes(),r.config.maxTime.getSeconds()),Qe=ek(ce,he,je);if(Qe>Le&&Qe=12)]),r.secondElement!==void 0&&(r.secondElement.value=ls(je)))}function v(ce){var he=Fs(ce),je=parseInt(he.value)+(ce.delta||0);(je/1e3>1||ce.key==="Enter"&&!/[^\d]/.test(je.toString()))&&K(je)}function m(ce,he,je,xe){if(he instanceof Array)return he.forEach(function(Re){return m(ce,Re,je,xe)});if(ce instanceof Array)return ce.forEach(function(Re){return m(Re,he,je,xe)});ce.addEventListener(he,je,xe),r._handlers.push({remove:function(){return ce.removeEventListener(he,je,xe)}})}function b(){vt("onChange")}function x(){if(r.config.wrap&&["open","close","toggle","clear"].forEach(function(je){Array.prototype.forEach.call(r.element.querySelectorAll("[data-"+je+"]"),function(xe){return m(xe,"click",r[je])})}),r.isMobile){qe();return}var ce=oR(ke,50);if(r._debouncedChange=oR(b,ule),r.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&m(r.daysContainer,"mouseover",function(je){r.config.mode==="range"&&le(Fs(je))}),m(r._input,"keydown",de),r.calendarContainer!==void 0&&m(r.calendarContainer,"keydown",de),!r.config.inline&&!r.config.static&&m(window,"resize",ce),window.ontouchstart!==void 0?m(window.document,"touchstart",Q):m(window.document,"mousedown",Q),m(window.document,"focus",Q,{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",Tt),m(r.monthNav,["keyup","increment"],v),m(r.daysContainer,"click",Ae)),r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0){var he=function(je){return Fs(je).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"],he),r.secondElement!==void 0&&m(r.secondElement,"focus",function(){return r.secondElement&&r.secondElement.select()}),r.amPM!==void 0&&m(r.amPM,"click",function(je){c(je)})}r.config.allowInput&&m(r._input,"blur",ie)}function w(ce,he){var je=ce!==void 0?r.parseDate(ce):r.latestSelectedDateObj||(r.config.minDate&&r.config.minDate>r.now?r.config.minDate:r.config.maxDate&&r.config.maxDate1),r.calendarContainer.appendChild(ce);var Re=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&&(!Re&&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 ze=hn("div","flatpickr-wrapper");r.element.parentNode&&r.element.parentNode.insertBefore(ze,r.element),ze.appendChild(r.element),r.altInput&&ze.appendChild(r.altInput),ze.appendChild(r.calendarContainer)}!r.config.static&&!r.config.inline&&(r.config.appendTo!==void 0?r.config.appendTo:window.document.body).appendChild(r.calendarContainer)}function T(ce,he,je,xe){var Re=re(he,!0),ze=hn("span",ce,he.getDate().toString());return ze.dateObj=he,ze.$i=xe,ze.setAttribute("aria-label",r.formatDate(he,r.config.ariaDateFormat)),ce.indexOf("hidden")===-1&&Ds(he,r.now)===0&&(r.todayDateElem=ze,ze.classList.add("today"),ze.setAttribute("aria-current","date")),Re?(ze.tabIndex=-1,Ce(he)&&(ze.classList.add("selected"),r.selectedDateElem=ze,r.config.mode==="range"&&(La(ze,"startRange",r.selectedDates[0]&&Ds(he,r.selectedDates[0],!0)===0),La(ze,"endRange",r.selectedDates[1]&&Ds(he,r.selectedDates[1],!0)===0),ce==="nextMonthDay"&&ze.classList.add("inRange")))):ze.classList.add("flatpickr-disabled"),r.config.mode==="range"&<(he)&&!Ce(he)&&ze.classList.add("inRange"),r.weekNumbers&&r.config.showMonths===1&&ce!=="prevMonthDay"&&xe%7===6&&r.weekNumbers.insertAdjacentHTML("beforeend",""+r.config.getWeek(he)+""),vt("onDayCreate",ze),ze}function A(ce){ce.focus(),r.config.mode==="range"&&le(ce)}function P(ce){for(var he=ce>0?0:r.config.showMonths-1,je=ce>0?r.config.showMonths:-1,xe=he;xe!=je;xe+=ce)for(var Re=r.daysContainer.children[xe],ze=ce>0?0:Re.children.length-1,Le=ce>0?Re.children.length:-1,Qe=ze;Qe!=Le;Qe+=ce){var mt=Re.children[Qe];if(mt.className.indexOf("hidden")===-1&&re(mt.dateObj))return mt}}function N(ce,he){for(var je=ce.className.indexOf("Month")===-1?ce.dateObj.getMonth():r.currentMonth,xe=he>0?r.config.showMonths:-1,Re=he>0?1:-1,ze=je-r.currentMonth;ze!=xe;ze+=Re)for(var Le=r.daysContainer.children[ze],Qe=je-r.currentMonth===ze?ce.$i+he:he<0?Le.children.length-1:0,mt=Le.children.length,ft=Qe;ft>=0&&ft0?mt:-1);ft+=Re){var It=Le.children[ft];if(It.className.indexOf("hidden")===-1&&re(It.dateObj)&&Math.abs(ce.$i-ft)>=Math.abs(he))return A(It)}r.changeMonth(Re),O(P(Re),0)}function O(ce,he){var je=a(),xe=H(je||document.body),Re=ce!==void 0?ce:xe?je:r.selectedDateElem!==void 0&&H(r.selectedDateElem)?r.selectedDateElem:r.todayDateElem!==void 0&&H(r.todayDateElem)?r.todayDateElem:P(he>0?1:-1);Re===void 0?r._input.focus():xe?N(Re,he):A(Re)}function C(ce,he){for(var je=(new Date(ce,he,1).getDay()-r.l10n.firstDayOfWeek+7)%7,xe=r.utils.getDaysInMonth((he-1+12)%12,ce),Re=r.utils.getDaysInMonth(he,ce),ze=window.document.createDocumentFragment(),Le=r.config.showMonths>1,Qe=Le?"prevMonthDay hidden":"prevMonthDay",mt=Le?"nextMonthDay hidden":"nextMonthDay",ft=xe+1-je,It=0;ft<=xe;ft++,It++)ze.appendChild(T("flatpickr-day "+Qe,new Date(ce,he-1,ft),ft,It));for(ft=1;ft<=Re;ft++,It++)ze.appendChild(T("flatpickr-day",new Date(ce,he,ft),ft,It));for(var Bt=Re+1;Bt<=42-je&&(r.config.showMonths===1||It%7!==0);Bt++,It++)ze.appendChild(T("flatpickr-day "+mt,new Date(ce,he+1,Bt%Re),Bt,It));var dr=hn("div","dayContainer");return dr.appendChild(ze),dr}function I(){if(r.daysContainer!==void 0){Q0(r.daysContainer),r.weekNumbers&&Q0(r.weekNumbers);for(var ce=document.createDocumentFragment(),he=0;he1||r.config.monthSelectorType!=="dropdown")){var ce=function(xe){return r.config.minDate!==void 0&&r.currentYear===r.config.minDate.getFullYear()&&xer.config.maxDate.getMonth())};r.monthsDropdownContainer.tabIndex=-1,r.monthsDropdownContainer.innerHTML="";for(var he=0;he<12;he++)if(ce(he)){var je=hn("option","flatpickr-monthDropdown-month");je.value=new Date(r.currentYear,he).getMonth().toString(),je.textContent=p2(he,r.config.shorthandCurrentMonth,r.l10n),je.tabIndex=-1,r.currentMonth===he&&(je.selected=!0),r.monthsDropdownContainer.appendChild(je)}}}function F(){var ce=hn("div","flatpickr-month"),he=window.document.createDocumentFragment(),je;r.config.showMonths>1||r.config.monthSelectorType==="static"?je=hn("span","cur-month"):(r.monthsDropdownContainer=hn("select","flatpickr-monthDropdown-months"),r.monthsDropdownContainer.setAttribute("aria-label",r.l10n.monthAriaLabel),m(r.monthsDropdownContainer,"change",function(Le){var Qe=Fs(Le),mt=parseInt(Qe.value,10);r.changeMonth(mt-r.currentMonth),vt("onMonthChange")}),R(),je=r.monthsDropdownContainer);var xe=X0("cur-year",{tabindex:"-1"}),Re=xe.getElementsByTagName("input")[0];Re.setAttribute("aria-label",r.l10n.yearAriaLabel),r.config.minDate&&Re.setAttribute("min",r.config.minDate.getFullYear().toString()),r.config.maxDate&&(Re.setAttribute("max",r.config.maxDate.getFullYear().toString()),Re.disabled=!!r.config.minDate&&r.config.minDate.getFullYear()===r.config.maxDate.getFullYear());var ze=hn("div","flatpickr-current-month");return ze.appendChild(je),ze.appendChild(xe),he.appendChild(ze),ce.appendChild(he),{container:ce,yearElement:Re,monthElement:je}}function M(){Q0(r.monthNav),r.monthNav.appendChild(r.prevMonthNav),r.config.showMonths&&(r.yearElements=[],r.monthElements=[]);for(var ce=r.config.showMonths;ce--;){var he=F();r.yearElements.push(he.yearElement),r.monthElements.push(he.monthElement),r.monthNav.appendChild(he.container)}r.monthNav.appendChild(r.nextMonthNav)}function Y(){return r.monthNav=hn("div","flatpickr-months"),r.yearElements=[],r.monthElements=[],r.prevMonthNav=hn("span","flatpickr-prev-month"),r.prevMonthNav.innerHTML=r.config.prevArrow,r.nextMonthNav=hn("span","flatpickr-next-month"),r.nextMonthNav.innerHTML=r.config.nextArrow,M(),Object.defineProperty(r,"_hidePrevMonthArrow",{get:function(){return r.__hidePrevMonthArrow},set:function(ce){r.__hidePrevMonthArrow!==ce&&(La(r.prevMonthNav,"flatpickr-disabled",ce),r.__hidePrevMonthArrow=ce)}}),Object.defineProperty(r,"_hideNextMonthArrow",{get:function(){return r.__hideNextMonthArrow},set:function(ce){r.__hideNextMonthArrow!==ce&&(La(r.nextMonthNav,"flatpickr-disabled",ce),r.__hideNextMonthArrow=ce)}}),r.currentYearElement=r.yearElements[0],Xe(),r.monthNav}function X(){r.calendarContainer.classList.add("hasTime"),r.config.noCalendar&&r.calendarContainer.classList.add("noCalendar");var ce=tk(r.config);r.timeContainer=hn("div","flatpickr-time"),r.timeContainer.tabIndex=-1;var he=hn("span","flatpickr-time-separator",":"),je=X0("flatpickr-hour",{"aria-label":r.l10n.hourAriaLabel});r.hourElement=je.getElementsByTagName("input")[0];var xe=X0("flatpickr-minute",{"aria-label":r.l10n.minuteAriaLabel});if(r.minuteElement=xe.getElementsByTagName("input")[0],r.hourElement.tabIndex=r.minuteElement.tabIndex=-1,r.hourElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getHours():r.config.time_24hr?ce.hours:d(ce.hours)),r.minuteElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getMinutes():ce.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(je),r.timeContainer.appendChild(he),r.timeContainer.appendChild(xe),r.config.time_24hr&&r.timeContainer.classList.add("time24hr"),r.config.enableSeconds){r.timeContainer.classList.add("hasSeconds");var Re=X0("flatpickr-second");r.secondElement=Re.getElementsByTagName("input")[0],r.secondElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getSeconds():ce.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(hn("span","flatpickr-time-separator",":")),r.timeContainer.appendChild(Re)}return r.config.time_24hr||(r.amPM=hn("span","flatpickr-am-pm",r.l10n.amPM[Al((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 $(){r.weekdayContainer?Q0(r.weekdayContainer):r.weekdayContainer=hn("div","flatpickr-weekdays");for(var ce=r.config.showMonths;ce--;){var he=hn("div","flatpickr-weekdaycontainer");r.weekdayContainer.appendChild(he)}return ee(),r.weekdayContainer}function ee(){if(r.weekdayContainer){var ce=r.l10n.firstDayOfWeek,he=aR(r.l10n.weekdays.shorthand);ce>0&&ce - `+he.join("")+` - - `}}function V(){r.calendarContainer.classList.add("hasWeeks");var ce=hn("div","flatpickr-weekwrapper");ce.appendChild(hn("span","flatpickr-weekday",r.l10n.weekAbbreviation));var he=hn("div","flatpickr-weeks");return ce.appendChild(he),{weekWrapper:ce,weekNumbers:he}}function D(ce,he){he===void 0&&(he=!0);var je=he?ce:ce-r.currentMonth;je<0&&r._hidePrevMonthArrow===!0||je>0&&r._hideNextMonthArrow===!0||(r.currentMonth+=je,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,vt("onYearChange"),R()),I(),vt("onMonthChange"),Xe())}function z(ce,he){if(ce===void 0&&(ce=!0),he===void 0&&(he=!0),r.input.value="",r.altInput!==void 0&&(r.altInput.value=""),r.mobileInput!==void 0&&(r.mobileInput.value=""),r.selectedDates=[],r.latestSelectedDateObj=void 0,he===!0&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth()),r.config.enableTime===!0){var je=tk(r.config),xe=je.hours,Re=je.minutes,ze=je.seconds;p(xe,Re,ze)}r.redraw(),ce&&vt("onChange")}function q(){r.isOpen=!1,r.isMobile||(r.calendarContainer!==void 0&&r.calendarContainer.classList.remove("open"),r._input!==void 0&&r._input.classList.remove("active")),vt("onClose")}function G(){r.config!==void 0&&vt("onDestroy");for(var ce=r._handlers.length;ce--;)r._handlers[ce].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 he=r.calendarContainer.parentNode;if(he.lastChild&&he.removeChild(he.lastChild),he.parentNode){for(;he.firstChild;)he.parentNode.insertBefore(he.firstChild,he);he.parentNode.removeChild(he)}}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(je){try{delete r[je]}catch{}})}function U(ce){return r.calendarContainer.contains(ce)}function Q(ce){if(r.isOpen&&!r.config.inline){var he=Fs(ce),je=U(he),xe=he===r.input||he===r.altInput||r.element.contains(he)||ce.path&&ce.path.indexOf&&(~ce.path.indexOf(r.input)||~ce.path.indexOf(r.altInput)),Re=!xe&&!je&&!U(ce.relatedTarget),ze=!r.config.ignoredFocusElements.some(function(Le){return Le.contains(he)});Re&&ze&&(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 K(ce){if(!(!ce||r.config.minDate&&cer.config.maxDate.getFullYear())){var he=ce,je=r.currentYear!==he;r.currentYear=he||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)),je&&(r.redraw(),vt("onYearChange"),R())}}function re(ce,he){var je;he===void 0&&(he=!0);var xe=r.parseDate(ce,void 0,he);if(r.config.minDate&&xe&&Ds(xe,r.config.minDate,he!==void 0?he:!r.minDateHasTime)<0||r.config.maxDate&&xe&&Ds(xe,r.config.maxDate,he!==void 0?he:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&r.config.disable.length===0)return!0;if(xe===void 0)return!1;for(var Re=!!r.config.enable,ze=(je=r.config.enable)!==null&&je!==void 0?je:r.config.disable,Le=0,Qe=void 0;Le=Qe.from.getTime()&&xe.getTime()<=Qe.to.getTime())return Re}return!Re}function H(ce){return r.daysContainer!==void 0?ce.className.indexOf("hidden")===-1&&ce.className.indexOf("flatpickr-disabled")===-1&&r.daysContainer.contains(ce):!1}function ie(ce){var he=ce.target===r._input,je=r._input.value.trimEnd()!==Be();he&&je&&!(ce.relatedTarget&&U(ce.relatedTarget))&&r.setDate(r._input.value,!0,ce.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function de(ce){var he=Fs(ce),je=r.config.wrap?e.contains(he):he===r._input,xe=r.config.allowInput,Re=r.isOpen&&(!xe||!je),ze=r.config.inline&&je&&!xe;if(ce.keyCode===13&&je){if(xe)return r.setDate(r._input.value,!0,he===r.altInput?r.config.altFormat:r.config.dateFormat),r.close(),he.blur();r.open()}else if(U(he)||Re||ze){var Le=!!r.timeContainer&&r.timeContainer.contains(he);switch(ce.keyCode){case 13:Le?(ce.preventDefault(),c(),Ee()):Ae(ce);break;case 27:ce.preventDefault(),Ee();break;case 8:case 46:je&&!r.config.allowInput&&(ce.preventDefault(),r.clear());break;case 37:case 39:if(!Le&&!je){ce.preventDefault();var Qe=a();if(r.daysContainer!==void 0&&(xe===!1||Qe&&H(Qe))){var mt=ce.keyCode===39?1:-1;ce.ctrlKey?(ce.stopPropagation(),D(mt),O(P(1),0)):O(void 0,mt)}}else r.hourElement&&r.hourElement.focus();break;case 38:case 40:ce.preventDefault();var ft=ce.keyCode===40?1:-1;r.daysContainer&&he.$i!==void 0||he===r.input||he===r.altInput?ce.ctrlKey?(ce.stopPropagation(),K(r.currentYear-ft),O(P(1),0)):Le||O(void 0,ft*7):he===r.currentYearElement?K(r.currentYear-ft):r.config.enableTime&&(!Le&&r.hourElement&&r.hourElement.focus(),c(ce),r._debouncedChange());break;case 9:if(Le){var It=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter(function(pr){return pr}),Bt=It.indexOf(he);if(Bt!==-1){var dr=It[Bt+(ce.shiftKey?-1:1)];ce.preventDefault(),(dr||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(he)&&ce.shiftKey&&(ce.preventDefault(),r._input.focus());break}}if(r.amPM!==void 0&&he===r.amPM)switch(ce.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],f(),ct();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],f(),ct();break}(je||U(he))&&vt("onKeyDown",ce)}function le(ce,he){if(he===void 0&&(he="flatpickr-day"),!(r.selectedDates.length!==1||ce&&(!ce.classList.contains(he)||ce.classList.contains("flatpickr-disabled")))){for(var je=ce?ce.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),xe=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),Re=Math.min(je,r.selectedDates[0].getTime()),ze=Math.max(je,r.selectedDates[0].getTime()),Le=!1,Qe=0,mt=0,ft=Re;ftRe&&ftQe)?Qe=ft:ft>xe&&(!mt||ft ."+he));It.forEach(function(Bt){var dr=Bt.dateObj,pr=dr.getTime(),an=Qe>0&&pr0&&pr>mt;if(an){Bt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Jn){Bt.classList.remove(Jn)});return}else if(Le&&!an)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Jn){Bt.classList.remove(Jn)}),ce!==void 0&&(ce.classList.add(je<=r.selectedDates[0].getTime()?"startRange":"endRange"),xeje&&pr===xe&&Bt.classList.add("endRange"),pr>=Qe&&(mt===0||pr<=mt)&&sle(pr,xe,je)&&Bt.classList.add("inRange"))})}}function ke(){r.isOpen&&!r.config.static&&!r.config.inline&&ue()}function ve(ce,he){if(he===void 0&&(he=r._positionElement),r.isMobile===!0){if(ce){ce.preventDefault();var je=Fs(ce);je&&je.blur()}r.mobileInput!==void 0&&(r.mobileInput.focus(),r.mobileInput.click()),vt("onOpen");return}else if(r._input.disabled||r.config.inline)return;var xe=r.isOpen;r.isOpen=!0,xe||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),vt("onOpen"),ue(he)),r.config.enableTime===!0&&r.config.noCalendar===!0&&r.config.allowInput===!1&&(ce===void 0||!r.timeContainer.contains(ce.relatedTarget))&&setTimeout(function(){return r.hourElement.select()},50)}function se(ce){return function(he){var je=r.config["_"+ce+"Date"]=r.parseDate(he,r.config.dateFormat),xe=r.config["_"+(ce==="min"?"max":"min")+"Date"];je!==void 0&&(r[ce==="min"?"minDateHasTime":"maxDateHasTime"]=je.getHours()>0||je.getMinutes()>0||je.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter(function(Re){return re(Re)}),!r.selectedDates.length&&ce==="min"&&h(je),ct()),r.daysContainer&&(Pe(),je!==void 0?r.currentYearElement[ce]=je.getFullYear().toString():r.currentYearElement.removeAttribute(ce),r.currentYearElement.disabled=!!xe&&je!==void 0&&xe.getFullYear()===je.getFullYear())}}function be(){var ce=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],he=va(va({},JSON.parse(JSON.stringify(e.dataset||{}))),t),je={};r.config.parseDate=he.parseDate,r.config.formatDate=he.formatDate,Object.defineProperty(r.config,"enable",{get:function(){return r.config._enable},set:function(It){r.config._enable=st(It)}}),Object.defineProperty(r.config,"disable",{get:function(){return r.config._disable},set:function(It){r.config._disable=st(It)}});var xe=he.mode==="time";if(!he.dateFormat&&(he.enableTime||xe)){var Re=to.defaultConfig.dateFormat||hm.dateFormat;je.dateFormat=he.noCalendar||xe?"H:i"+(he.enableSeconds?":S":""):Re+" H:i"+(he.enableSeconds?":S":"")}if(he.altInput&&(he.enableTime||xe)&&!he.altFormat){var ze=to.defaultConfig.altFormat||hm.altFormat;je.altFormat=he.noCalendar||xe?"h:i"+(he.enableSeconds?":S K":" K"):ze+(" h:i"+(he.enableSeconds?":S":"")+" K")}Object.defineProperty(r.config,"minDate",{get:function(){return r.config._minDate},set:se("min")}),Object.defineProperty(r.config,"maxDate",{get:function(){return r.config._maxDate},set:se("max")});var Le=function(It){return function(Bt){r.config[It==="min"?"_minTime":"_maxTime"]=r.parseDate(Bt,"H:i:S")}};Object.defineProperty(r.config,"minTime",{get:function(){return r.config._minTime},set:Le("min")}),Object.defineProperty(r.config,"maxTime",{get:function(){return r.config._maxTime},set:Le("max")}),he.mode==="time"&&(r.config.noCalendar=!0,r.config.enableTime=!0),Object.assign(r.config,je,he);for(var Qe=0;Qe-1?r.config[ft]=Z5(mt[ft]).map(s).concat(r.config[ft]):typeof he[ft]>"u"&&(r.config[ft]=mt[ft])}he.altInputClass||(r.config.altInputClass=De().className+" "+r.config.altInputClass),vt("onParseConfig")}function De(){return r.config.wrap?e.querySelector("[data-input]"):e}function ae(){typeof r.config.locale!="object"&&typeof to.l10ns[r.config.locale]>"u"&&r.config.errorHandler(new Error("flatpickr: invalid locale "+r.config.locale)),r.l10n=va(va({},to.l10ns.default),typeof r.config.locale=="object"?r.config.locale:r.config.locale!=="default"?to.l10ns[r.config.locale]:void 0),ih.D="("+r.l10n.weekdays.shorthand.join("|")+")",ih.l="("+r.l10n.weekdays.longhand.join("|")+")",ih.M="("+r.l10n.months.shorthand.join("|")+")",ih.F="("+r.l10n.months.longhand.join("|")+")",ih.K="("+r.l10n.amPM[0]+"|"+r.l10n.amPM[1]+"|"+r.l10n.amPM[0].toLowerCase()+"|"+r.l10n.amPM[1].toLowerCase()+")";var ce=va(va({},t),JSON.parse(JSON.stringify(e.dataset||{})));ce.time_24hr===void 0&&to.defaultConfig.time_24hr===void 0&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=uH(r),r.parseDate=W3({config:r.config,l10n:r.l10n})}function ue(ce){if(typeof r.config.position=="function")return void r.config.position(r,ce);if(r.calendarContainer!==void 0){vt("onPreCalendarPosition");var he=ce||r._positionElement,je=Array.prototype.reduce.call(r.calendarContainer.children,(function(xs,el){return xs+el.offsetHeight}),0),xe=r.calendarContainer.offsetWidth,Re=r.config.position.split(" "),ze=Re[0],Le=Re.length>1?Re[1]:null,Qe=he.getBoundingClientRect(),mt=window.innerHeight-Qe.bottom,ft=ze==="above"||ze!=="below"&&mtje,It=window.pageYOffset+Qe.top+(ft?-je-2:he.offsetHeight+2);if(La(r.calendarContainer,"arrowTop",!ft),La(r.calendarContainer,"arrowBottom",ft),!r.config.inline){var Bt=window.pageXOffset+Qe.left,dr=!1,pr=!1;Le==="center"?(Bt-=(xe-Qe.width)/2,dr=!0):Le==="right"&&(Bt-=xe-Qe.width,pr=!0),La(r.calendarContainer,"arrowLeft",!dr&&!pr),La(r.calendarContainer,"arrowCenter",dr),La(r.calendarContainer,"arrowRight",pr);var an=window.document.body.offsetWidth-(window.pageXOffset+Qe.right),Jn=Bt+xe>window.document.body.offsetWidth,Fi=an+xe>window.document.body.offsetWidth;if(La(r.calendarContainer,"rightMost",Jn),!r.config.static)if(r.calendarContainer.style.top=It+"px",!Jn)r.calendarContainer.style.left=Bt+"px",r.calendarContainer.style.right="auto";else if(!Fi)r.calendarContainer.style.left="auto",r.calendarContainer.style.right=an+"px";else{var Fn=Me();if(Fn===void 0)return;var Bo=window.document.body.offsetWidth,io=Math.max(0,Bo/2-xe/2),Wo=".flatpickr-calendar.centerMost:before",Yi=".flatpickr-calendar.centerMost:after",qo=Fn.cssRules.length,Ca="{left:"+Qe.left+"px;right:auto;}";La(r.calendarContainer,"rightMost",!1),La(r.calendarContainer,"centerMost",!0),Fn.insertRule(Wo+","+Yi+Ca,qo),r.calendarContainer.style.left=io+"px",r.calendarContainer.style.right="auto"}}}}function Me(){for(var ce=null,he=0;her.currentMonth+r.config.showMonths-1)&&r.config.mode!=="range";if(r.selectedDateElem=xe,r.config.mode==="single")r.selectedDates=[Re];else if(r.config.mode==="multiple"){var Le=Ce(Re);Le?r.selectedDates.splice(parseInt(Le),1):r.selectedDates.push(Re)}else r.config.mode==="range"&&(r.selectedDates.length===2&&r.clear(!1,!1),r.latestSelectedDateObj=Re,r.selectedDates.push(Re),Ds(Re,r.selectedDates[0],!0)!==0&&r.selectedDates.sort(function(It,Bt){return It.getTime()-Bt.getTime()}));if(f(),ze){var Qe=r.currentYear!==Re.getFullYear();r.currentYear=Re.getFullYear(),r.currentMonth=Re.getMonth(),Qe&&(vt("onYearChange"),R()),vt("onMonthChange")}if(Xe(),I(),ct(),!ze&&r.config.mode!=="range"&&r.config.showMonths===1?A(xe):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 mt=r.config.mode==="single"&&!r.config.enableTime,ft=r.config.mode==="range"&&r.selectedDates.length===2&&!r.config.enableTime;(mt||ft)&&Ee()}b()}}var Ye={locale:[ae,ee],showMonths:[M,l,$],minDate:[w],maxDate:[w],positionElement:[Pt],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 rt(ce,he){if(ce!==null&&typeof ce=="object"){Object.assign(r.config,ce);for(var je in ce)Ye[je]!==void 0&&Ye[je].forEach(function(xe){return xe()})}else r.config[ce]=he,Ye[ce]!==void 0?Ye[ce].forEach(function(xe){return xe()}):X5.indexOf(ce)>-1&&(r.config[ce]=Z5(he));r.redraw(),ct(!0)}function He(ce,he){var je=[];if(ce instanceof Array)je=ce.map(function(xe){return r.parseDate(xe,he)});else if(ce instanceof Date||typeof ce=="number")je=[r.parseDate(ce,he)];else if(typeof ce=="string")switch(r.config.mode){case"single":case"time":je=[r.parseDate(ce,he)];break;case"multiple":je=ce.split(r.config.conjunction).map(function(xe){return r.parseDate(xe,he)});break;case"range":je=ce.split(r.l10n.rangeSeparator).map(function(xe){return r.parseDate(xe,he)});break}else r.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(ce)));r.selectedDates=r.config.allowInvalidPreload?je:je.filter(function(xe){return xe instanceof Date&&re(xe,!1)}),r.config.mode==="range"&&r.selectedDates.sort(function(xe,Re){return xe.getTime()-Re.getTime()})}function xt(ce,he,je){if(he===void 0&&(he=!1),je===void 0&&(je=r.config.dateFormat),ce!==0&&!ce||ce instanceof Array&&ce.length===0)return r.clear(he);He(ce,je),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),w(void 0,he),h(),r.selectedDates.length===0&&r.clear(!1),ct(he),he&&vt("onChange")}function st(ce){return ce.slice().map(function(he){return typeof he=="string"||typeof he=="number"||he instanceof Date?r.parseDate(he,void 0,!0):he&&typeof he=="object"&&he.from&&he.to?{from:r.parseDate(he.from,void 0),to:r.parseDate(he.to,void 0)}:he}).filter(function(he){return he})}function Te(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;var ce=r.config.defaultDate||((r.input.nodeName==="INPUT"||r.input.nodeName==="TEXTAREA")&&r.input.placeholder&&r.input.value===r.input.placeholder?null:r.input.value);ce&&He(ce,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 et(){if(r.input=De(),!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=hn(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"),Pt()}function Pt(){r._positionElement=r.config.positionElement||r._input}function qe(){var ce=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=hn("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=ce,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr=ce==="datetime-local"?"Y-m-d\\TH:i:S":ce==="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(he){r.setDate(Fs(he).value,!1,r.mobileFormatStr),vt("onChange"),vt("onClose")})}function Et(ce){if(r.isOpen===!0)return r.close();r.open(ce)}function vt(ce,he){if(r.config!==void 0){var je=r.config[ce];if(je!==void 0&&je.length>0)for(var xe=0;je[xe]&&xe=0&&Ds(ce,r.selectedDates[1])<=0}function Xe(){r.config.noCalendar||r.isMobile||!r.monthNav||(r.yearElements.forEach(function(ce,he){var je=new Date(r.currentYear,r.currentMonth,1);je.setMonth(r.currentMonth+he),r.config.showMonths>1||r.config.monthSelectorType==="static"?r.monthElements[he].textContent=p2(je.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=je.getMonth().toString(),ce.value=je.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 Be(ce){var he=ce||(r.config.altInput?r.config.altFormat:r.config.dateFormat);return r.selectedDates.map(function(je){return r.formatDate(je,he)}).filter(function(je,xe,Re){return r.config.mode!=="range"||r.config.enableTime||Re.indexOf(je)===xe}).join(r.config.mode!=="range"?r.config.conjunction:r.l10n.rangeSeparator)}function ct(ce){ce===void 0&&(ce=!0),r.mobileInput!==void 0&&r.mobileFormatStr&&(r.mobileInput.value=r.latestSelectedDateObj!==void 0?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=Be(r.config.dateFormat),r.altInput!==void 0&&(r.altInput.value=Be(r.config.altFormat)),ce!==!1&&vt("onValueUpdate")}function Tt(ce){var he=Fs(ce),je=r.prevMonthNav.contains(he),xe=r.nextMonthNav.contains(he);je||xe?D(je?-1:1):r.yearElements.indexOf(he)>=0?he.select():he.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):he.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}function We(ce){ce.preventDefault();var he=ce.type==="keydown",je=Fs(ce),xe=je;r.amPM!==void 0&&je===r.amPM&&(r.amPM.textContent=r.l10n.amPM[Al(r.amPM.textContent===r.l10n.amPM[0])]);var Re=parseFloat(xe.getAttribute("min")),ze=parseFloat(xe.getAttribute("max")),Le=parseFloat(xe.getAttribute("step")),Qe=parseInt(xe.value,10),mt=ce.delta||(he?ce.which===38?1:-1:0),ft=Qe+Le*mt;if(typeof xe.value<"u"&&xe.value.length===2){var It=xe===r.hourElement,Bt=xe===r.minuteElement;ftze&&(ft=xe===r.hourElement?ft-ze-Al(!r.amPM):Re,Bt&&j(void 0,1,r.hourElement)),r.amPM&&It&&(Le===1?ft+Qe===23:Math.abs(ft-Qe)>Le)&&(r.amPM.textContent=r.l10n.amPM[Al(r.amPM.textContent===r.l10n.amPM[0])]),xe.value=ls(ft)}}return o(),r}function gm(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=to(c,{enableTime:!0,time_24hr:!0,dateFormat:"Y-m-d H:i",allowInput:!0,defaultDate:lR(e),onChange:d=>{const f=d[0];t(f?sR(f):"")}});return l.current=u,()=>{u.destroy(),l.current=null}},[]),S.useEffect(()=>{const c=l.current;if(!c)return;const u=c.selectedDates[0],d=u?sR(u):"";if(e===d)return;const f=lR(e);f?c.setDate(f,!1):c.clear(!1)},[e]),S.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 Zu={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"},fle={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px",display:"block"},h2={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px",lineHeight:"1.45"},ple=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),hle=["always_live","always_sched","manual","quiz_master"],gle=[{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"}],q3=["-- Select Status --","Active","Draft"];function qT(){return{title:"",description:"",status:q3[0],displayMode:"",isLive:"No",scheduledStart:"",scheduledEnd:"",timeRestricted:"No",timeLimit:0,showResults:"No",multipleAttempts:"No",rewardQuizPollSubmitted:"",rewardQuizCorrectPerQuestion:"",rewardPollParticipation:""}}function g2(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 m2(e){if(!(e!=null&&e.trim()))return;const t=new Date(e).getTime();if(!Number.isNaN(t))return new Date(t).toISOString()}function cR(){const e=new Date;e.setMinutes(0,0,0);const t=new Date(e.getTime()+7200*1e3);return{start:g2(e.toISOString()),end:g2(t.toISOString())}}function mle(e){return hle.includes(e)}function vle(e,t){const r=e.settings||{},n=r.rewardRules&&typeof r.rewardRules=="object"?r.rewardRules:{};let o=typeof r.displayMode=="string"?r.displayMode:"";(!o||!mle(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?g2(r.startTime):"",scheduledEnd:a?g2(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 Fg(e){const t=String(e??"").trim();if(t==="")return;const r=Number(t);return Number.isFinite(r)?r:void 0}function gS(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?m2(e.scheduledStart)??null:null,endTime:r?m2(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=Fg(e.rewardQuizPollSubmitted),s=Fg(e.rewardQuizCorrectPerQuestion);a!==void 0&&(o.quizPollSubmitted=a),s!==void 0&&(o.quizCorrectPerQuestion=s)}else if(t==="poll"){const a=Fg(e.rewardPollParticipation);a!==void 0&&(o.pollParticipation=a)}else{const a=Fg(e.rewardQuizPollSubmitted),s=Fg(e.rewardQuizCorrectPerQuestion),l=Fg(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 as({label:e,hint:t,required:r,error:n,children:o}){return i.jsxs("div",{children:[i.jsxs("label",{style:fle,children:[e,r&&ple]}),o,t&&!n&&i.jsx("p",{style:h2,children:t}),n&&i.jsx("p",{style:{...h2,color:"var(--destructive)"},children:n})]})}function zg({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:{...Zu,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 yle({q:e,index:t,onEdit:r,onDelete:n,showPerQuestionTimeLimit:o}){const[a,s]=S.useState(!1);return i.jsxs("div",{onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:a?"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(l=>l.imageUrl)&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"with images"}),o&&typeof e.timeLimit=="number"&&e.timeLimit>0?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.timeLimit,"s limit"]}):null,i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d"},children:[e.options.filter(l=>l.isCorrect).length," correct"]})]})]}),i.jsxs("div",{style:{display:"flex",gap:"4px",opacity:a?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:l=>{l.currentTarget.style.borderColor="var(--primary)",l.currentTarget.style.color="var(--primary)"},onMouseLeave:l=>{l.currentTarget.style.borderColor="var(--border)",l.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{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:l=>{l.currentTarget.style.borderColor="var(--destructive)",l.currentTarget.style.color="var(--destructive)"},onMouseLeave:l=>{l.currentTarget.style.borderColor="var(--border)",l.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})}function Ax({kind:e,initial:t,onClose:r,onSave:n,eventId:o,variant:a="modal"}){const[s,l]=S.useState("settings"),[c,u]=S.useState((t==null?void 0:t.questions)??[]),[d,f]=S.useState(!1),[h,p]=S.useState(null),[v,m]=S.useState({}),[b,x]=S.useState((t==null?void 0:t.form)??qT()),w=e==="poll"?"Poll":"Quiz",k=ile(b),j=(R,F)=>{x(M=>({...M,[R]:F})),v[R]&&m(M=>({...M,[R]:""}))},_=()=>{const R={};if(b.title.trim()||(R.title=`${w} title is required.`),b.status===q3[0]&&(R.status="Please select a status."),b.displayMode||(R.displayMode="Please select a display mode."),b.displayMode==="always_sched"){b.scheduledStart.trim()||(R.scheduledStart="Start date & time is required."),b.scheduledEnd.trim()||(R.scheduledEnd="End date & time is required.");const F=new Date(b.scheduledStart).getTime(),M=new Date(b.scheduledEnd).getTime();Number.isFinite(F)&&Number.isFinite(M)&&M<=F&&(R.scheduledEnd="End must be after start.")}return m(R),Object.keys(R).length===0},T=()=>{if(c.length===0){m(R=>({...R,questions:"Add at least one question."}));return}if(k&&c.some(F=>!F.timeLimit||F.timeLimit<=0)){m(F=>({...F,questions:"Each question needs a time limit (seconds) in Quiz Master mode with Time Restricted enabled."}));return}n==null||n({form:b,questions:c})},A=R=>u(F=>[...F,R]),P=R=>u(F=>F.filter(M=>M.id!==R)),N=R=>u(F=>F.map(M=>M.id===R.id?R:M)),O=[{value:"No",label:"No"},{value:"Yes",label:"Yes"}],I=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:T,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:()=>{_()&&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(Gt,{size:16})})]})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["settings","questions"].map((R,F)=>i.jsxs("button",{type:"button",onClick:()=>{R==="questions"?_()&&l("questions"):l("settings")},style:{padding:"10px 0",marginRight:"24px",background:"none",border:"none",borderBottom:`2px solid ${s===R?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:s===R?"var(--font-weight-medium)":"var(--font-weight-normal)",color:s===R?"var(--primary)":"var(--muted)",display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:s===R?"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}),R==="settings"?"Settings":"Questions"]},R))}),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(as,{label:`${w} Title`,required:!0,error:v.title,children:i.jsx("input",{value:b.title,onChange:R=>j("title",R.target.value),placeholder:`Enter ${w.toLowerCase()} title`,style:{...Zu,borderColor:v.title?"var(--destructive)":"var(--border)"},onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor=v.title?"var(--destructive)":"var(--border)"}})}),i.jsx(as,{label:"Description",children:i.jsx("textarea",{value:b.description,onChange:R=>j("description",R.target.value),rows:3,placeholder:"Enter description",style:{...Zu,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5"},onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor="var(--border)"}})}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Status",required:!0,error:v.status,children:i.jsx(zg,{value:b.status,onChange:R=>j("status",R),options:q3.map(R=>({value:R,label:R})),error:v.status})}),i.jsx(as,{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(zg,{value:b.isLive,onChange:R=>j("isLive",R),options:O})})]}),i.jsx(as,{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:v.displayMode,children:i.jsx(zg,{value:b.displayMode,onChange:R=>j("displayMode",R),options:gle,error:v.displayMode})}),b.displayMode==="always_sched"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Start date & time",required:!0,error:v.scheduledStart,children:i.jsx(Pf,{value:b.scheduledStart,onChange:R=>j("scheduledStart",R),style:Zu,hasError:!!v.scheduledStart})}),i.jsx(as,{label:"End date & time",required:!0,error:v.scheduledEnd,children:i.jsx(Pf,{value:b.scheduledEnd,onChange:R=>j("scheduledEnd",R),style:Zu,hasError:!!v.scheduledEnd})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:k?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Time Restricted",required:!0,hint:k?"When enabled, set a time limit on each question in the Questions step (Quiz Master mode).":"If enabled, enforce a time limit when the user takes the quiz/poll (synced to the database and live clients).",children:i.jsx(zg,{value:b.timeRestricted,onChange:R=>j("timeRestricted",R),options:O})}),k?null:i.jsx(as,{label:"Time Limit (seconds)",hint:"Only used if Time Restricted is Yes.",children:i.jsx("input",{type:"number",min:0,value:b.timeLimit,onChange:R=>j("timeLimit",Number(R.target.value)),style:Zu,onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor="var(--border)"}})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Show Results After Submission",required:!0,hint:"Show results/score after submit.",children:i.jsx(zg,{value:b.showResults,onChange:R=>j("showResults",R),options:O})}),i.jsx(as,{label:"Allow Multiple Attempts",required:!0,children:i.jsx(zg,{value:b.multipleAttempts,onChange:R=>j("multipleAttempts",R),options:O})})]}),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:{...h2,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(as,{label:"Points per quiz submission",hint:"When a visitor submits this quiz.",children:i.jsx("input",{type:"number",min:0,value:b.rewardQuizPollSubmitted,onChange:R=>j("rewardQuizPollSubmitted",R.target.value),placeholder:"Inherit",style:Zu})}),i.jsx(as,{label:"Points per correct question",hint:"Loyalty only; separate from scoring points per question.",children:i.jsx("input",{type:"number",min:0,value:b.rewardQuizCorrectPerQuestion,onChange:R=>j("rewardQuizCorrectPerQuestion",R.target.value),placeholder:"Inherit",style:Zu})})]}):i.jsx("div",{style:{maxWidth:"360px"},children:i.jsx(as,{label:"Points for poll/survey participation",hint:"When a visitor submits this poll.",children:i.jsx("input",{type:"number",min:0,value:b.rewardPollParticipation,onChange:R=>j("rewardPollParticipation",R.target.value),placeholder:"Inherit",style:Zu})})})]})]}),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(gr,{size:13})," Add Question"]})]}),v.questions&&i.jsx("p",{style:{...h2,color:"var(--destructive)"},children:v.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(tS,{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(gr,{size:13})," Add First Question"]})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[c.map((R,F)=>i.jsx(yle,{q:R,index:F,onEdit:()=>p(R),onDelete:()=>P(R.id),showPerQuestionTimeLimit:k},R.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:R=>{R.currentTarget.style.borderColor="var(--primary)",R.currentTarget.style.color="var(--primary)"},onMouseLeave:R=>{R.currentTarget.style.borderColor="var(--border)",R.currentTarget.style.color="var(--muted)"},children:[i.jsx(gr,{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:()=>{_()&&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:T,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"?I: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:I}),d&&i.jsx(iR,{eventId:o,showPerQuestionTimeLimit:k,onClose:()=>f(!1),onSave:A}),h&&i.jsx(iR,{eventId:o,initial:h,showPerQuestionTimeLimit:k,onClose:()=>p(null),onSave:N})]})}const $3="Registration Form";async function xle(e,t){var a;const n=(await Mo.listForEvent(e)).filter(s=>s.type==="registration"),o=t==null?void 0:t.trim();if(o){const s=n.find(l=>l._id===o);if(s)return s;try{const l=await Mo.get(o);if(l.type==="registration"){const c=((a=n.find(u=>u._id===l._id))==null?void 0:a.submissionCount)??0;return{...l,submissionCount:c}}}catch{}}return n[0]??null}function ble(e){var t;return((t=e==null?void 0:e.name)==null?void 0:t.trim())||$3}const U3="Feedback form";async function wle(e){return(await Mo.listForEvent(e)).filter(n=>n.type==="feedback"||n.type==="survey")[0]??null}function Sle(e){var t;return((t=e==null?void 0:e.name)==null?void 0:t.trim())||U3}function Np({icon:e,title:t,description:r,meta:n,actions:o}){const s=Si()==="mobile";return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:s?"14px":"16px",display:"flex",flexDirection:"column",gap:"12px",minHeight:"auto"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",flex:1},children:[i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"var(--radius-button)",background:"color-mix(in srgb, var(--primary) 12%, transparent)",color:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),i.jsxs("div",{style:{minWidth:0,flex:1},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:t}),r?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.4},children:r}):null,n?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0"},children:n}):null]})]}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"nowrap"},children:o})]})}function bl(e=!1){return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"6px",flex:"1 1 0",minWidth:0,padding:"6px 8px",borderRadius:"var(--radius-button)",border:e?"none":"1px solid var(--border)",background:e?"var(--primary)":"var(--card)",color:e?"var(--primary-foreground)":"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"}}function jle({formName:e,onClose:t}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,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":"default-reg-responses-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)"},children:[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:"default-reg-responses-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:e})]}),i.jsx("button",{type:"button",onClick:t,"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(Gt,{size:18})})]}),i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 24px",textAlign:"center"},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)",margin:"0 0 8px"},children:"No responses yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:"360px",lineHeight:1.5},children:"Using the default registration form (first name, last name, email). Save the form via Edit to customize it and start collecting responses."})]})})]})]})}function kle({formName:e,onClose:t}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,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":"default-feedback-responses-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)"},children:[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:"default-feedback-responses-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:e})]}),i.jsx("button",{type:"button",onClick:t,"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(Gt,{size:18})})]}),i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 24px",textAlign:"center"},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)",margin:"0 0 8px"},children:"No responses yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:"360px",lineHeight:1.5},children:"Save a feedback form via Edit to start collecting responses from attendees."})]})})]})]})}function _le(){const{selectedEventId:e,setActiveNav:t,setPermissionsOpenAddOnce:r}=Li(),n=Si(),s=n==="mobile"?"1fr":n==="tablet"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fill, minmax(240px, 1fr))",[l,c]=S.useState(),[u,d]=S.useState(null),[f,h]=S.useState(!1),[p,v]=S.useState(!1),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState(!1),[N,O]=S.useState({polls:0,quizzes:0}),[C,I]=S.useState(!1),[R,F]=S.useState(!1),[M,Y]=S.useState(!1),[X,$]=S.useState({members:0,invites:0}),[ee,V]=S.useState(!1),[D,z]=S.useState(0),[q,G]=S.useState(!1),[U,Q]=S.useState(null),[K,re]=S.useState(!1),[H,ie]=S.useState(!1),[de,le]=S.useState(null),[ke,ve]=S.useState(0),[se,be]=S.useState(!1),[De,ae]=S.useState(0),[ue,Me]=S.useState(!1),[Se,Pe]=S.useState(!1);S.useEffect(()=>{if(!e){c(void 0),Q(null);return}let je=!1;return Lr.get(e).then(xe=>{var Re,ze,Le;je||(c((ze=(Re=xe.data)==null?void 0:Re.website)==null?void 0:ze.registrationFormId),Q(((Le=xe.data)==null?void 0:Le.name)??null))}),()=>{je=!0}},[e]);const Ee=S.useCallback(async()=>{if(!e){d(null),h(!1);return}h(!0);try{const je=await xle(e,l);d(je)}catch{d(null)}finally{h(!1)}},[e,l]);S.useEffect(()=>{Ee()},[Ee]);const Ae=S.useCallback(async()=>{if(!e){w(null),j(!1);return}j(!0);try{const je=await wle(e);w(je)}catch{w(null)}finally{j(!1)}},[e]);S.useEffect(()=>{Ae()},[Ae]);const Ye=S.useCallback(async()=>{var je;if(!e){O({polls:0,quizzes:0}),I(!1);return}I(!0);try{const Re=((je=(await Pi.listByEvent(e)).data)==null?void 0:je.quizPolls)??[];O({polls:Re.filter(ze=>ze.type==="poll").length,quizzes:Re.filter(ze=>ze.type==="quiz").length})}catch{O({polls:0,quizzes:0})}finally{I(!1)}},[e]);S.useEffect(()=>{Ye()},[Ye]);const rt=S.useCallback(async()=>{var je,xe;if(!e){$({members:0,invites:0}),V(!1);return}V(!0);try{const Re=await wa.listStaff(e);Re.data?$({members:((je=Re.data.members)==null?void 0:je.length)??0,invites:((xe=Re.data.invites)==null?void 0:xe.length)??0}):$({members:0,invites:0})}catch{$({members:0,invites:0})}finally{V(!1)}},[e]);S.useEffect(()=>{rt()},[rt]);const He=S.useCallback(async()=>{var je,xe;if(!e){z(0),G(!1);return}G(!0);try{const Re=await wx.list({event:e,limit:100});z(((xe=(je=Re.data)==null?void 0:je.batches)==null?void 0:xe.length)??0)}catch{z(0)}finally{G(!1)}},[e]);S.useEffect(()=>{He()},[He]);const xt=S.useCallback(async()=>{if(!e){ve(0),be(!1);return}be(!0);try{const je=await Ky.list(e);ve(je.length)}catch{ve(0)}finally{be(!1)}},[e]);S.useEffect(()=>{xt()},[xt]);const st=S.useCallback(async()=>{var je;if(!e){ae(0),Me(!1);return}Me(!0);try{const xe=await Lr.get(e);ae(Vae((je=xe.data)==null?void 0:je.rewardRules))}catch{ae(0)}finally{Me(!1)}},[e]);S.useEffect(()=>{st()},[st]);const Te=()=>{ie(!1),le(null),He()},et=()=>{le(null),ie(!0)},Pt=je=>{re(!1),le(je),ie(!0)},qe=()=>{v(!1),Ee()},Et=()=>{T(!1),Ae()},vt=ble(u),Ft=Sle(x),Ce=e?f?"Loading…":`${((u==null?void 0:u.submissionCount)??0).toLocaleString()} response${((u==null?void 0:u.submissionCount)??0)===1?"":"s"}`:"Select an event to view responses",lt=e?k?"Loading…":`${((x==null?void 0:x.submissionCount)??0).toLocaleString()} response${((x==null?void 0:x.submissionCount)??0)===1?"":"s"}`:"Select an event to view responses",Xe=!e,Be=e?C?"Loading…":`${N.polls} poll${N.polls===1?"":"s"} · ${N.quizzes} quiz${N.quizzes===1?"":"zes"}`:"Select an event to create polls and quizzes",ct=e?ee?"Loading…":`${X.members} member${X.members===1?"":"s"} · ${X.invites} pending invite${X.invites===1?"":"s"}`:"Select an event to manage team access",Tt=e?q?"Loading…":`${D} badge${D===1?"":"s"}`:"Select an event to manage badges",We=e?se?"Loading…":`${ke} ticket type${ke===1?"":"s"}`:"Select an event to configure tickets",ce=e?ue?"Loading…":De===0?"No rules configured":`${De} rule${De===1?"":"s"} configured`:"Select an event to configure reward rules",he=async(je,xe)=>{var mt,ft;if(!e)return;const ze=(ft=(mt=(await ta.list(e)).data)==null?void 0:mt.sessions)==null?void 0:ft[0],Le={...ze!=null&&ze._id?{session:ze._id}:{},title:xe.form.title,type:je,description:xe.form.description||void 0,questions:xe.questions.map(It=>hS(It,je)),settings:gS(xe.form,je)};(await Pi.create(e,Le)).error||(je==="poll"?F(!1):Y(!1),Ye())};return i.jsxs(i.Fragment,{children:[i.jsxs("section",{"aria-label":"Event modules",style:{display:"grid",gridTemplateColumns:s,gap:"12px"},children:[i.jsx(Np,{icon:i.jsx(Sh,{size:18}),title:$3,meta:Ce,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>v(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Edit"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>b(!0),children:"Responses"})]})}),i.jsx(Np,{icon:i.jsx(dd,{size:18}),title:U3,meta:lt,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>T(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Edit"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>P(!0),children:"View Responses"})]})}),i.jsx(Np,{icon:i.jsx(tne,{size:18}),title:"Users & Permissions",meta:ct,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>t("permissions"),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"View"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>{r(!0),t("permissions")},children:"Add New"})]})}),i.jsx(Np,{icon:i.jsx(Ad,{size:18}),title:"Activities",meta:Be,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>F(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Poll"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>Y(!0),children:"Quiz"})]})}),i.jsx(Np,{icon:i.jsx(Cx,{size:18}),title:"Tag & Badge Configuration",meta:Tt,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>re(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"View Badges"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:et,children:"Add Badge"})]})}),i.jsx(Np,{icon:i.jsx(A$,{size:18}),title:"Ticket configuration",meta:We,actions:i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>t("ticketing"),children:"View"})}),i.jsx(Np,{icon:i.jsx(nu,{size:18}),title:"Reward Points Config",meta:ce,actions:i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>Pe(!0),children:"View"})})]}),p&&e?i.jsx(tx,{mode:"registration",eventId:e,formId:u==null?void 0:u._id,defaultFormName:u?void 0:$3,onClose:()=>v(!1),onSuccess:qe}):null,m&&e&&(u!=null&&u._id)?i.jsx(D3,{formId:u._id,formName:vt,onClose:()=>b(!1)}):null,m&&e&&!(u!=null&&u._id)?i.jsx(jle,{formName:vt,onClose:()=>b(!1)}):null,_&&e?i.jsx(tx,{mode:"feedback",eventId:e,formId:x==null?void 0:x._id,defaultFormName:x?void 0:U3,onClose:()=>T(!1),onSuccess:Et}):null,A&&e&&(x!=null&&x._id)?i.jsx(D3,{formId:x._id,formName:Ft,onClose:()=>P(!1)}):null,A&&e&&!(x!=null&&x._id)?i.jsx(kle,{formName:Ft,onClose:()=>P(!1)}):null,R?i.jsx(Ax,{kind:"poll",eventId:e??void 0,onClose:()=>F(!1),onSave:je=>void he("poll",je)}):null,M?i.jsx(Ax,{kind:"quiz",eventId:e??void 0,onClose:()=>Y(!1),onSave:je=>void he("quiz",je)}):null,K&&e?i.jsx(tle,{eventId:e,eventName:U??void 0,onClose:()=>re(!1),onAddBadge:()=>{re(!1),et()},onDuplicateBadge:Pt}):null,H&&e?i.jsx(lH,{initialEventId:e,duplicateFromBatchId:de,onClose:()=>{ie(!1),le(null)},onSuccess:Te},de??"create"):null,Se&&e?i.jsx(Kae,{eventId:e,onClose:()=>Pe(!1),onSaved:()=>void st()}):null]})}function J0(e){return e==null||Number.isNaN(e)?"—":e.toLocaleString()}function Cle({loading:e,participantCount:t,sessionCount:r,quizPollCount:n,pointsAwarded:o,statusCounts:a,upcomingSessionCount:s,pointsRedeemed:l}){const c=Si(),u=c==="mobile"?2:4,d=S.useMemo(()=>{if(e)return;const v=(a==null?void 0:a.checked_in)??0,m=(a==null?void 0:a.confirmed)??0;if(v)return`${v.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(Ri,{size:15}),label:"Participants",value:e?"—":J0(t),trend:d,trendUp:!!(a!=null&&a.checked_in&&a.checked_in>0),accent:"var(--chart-1)"},{icon:i.jsx(y$,{size:15}),label:"Sessions",value:e?"—":J0(r),trend:f,trendUp:!1,accent:"var(--chart-3)"},{icon:i.jsx(Ad,{size:15}),label:"Quizzes & Polls",value:e?"—":J0(n),trend:void 0,trendUp:!1,accent:"var(--chart-4)"},{icon:i.jsx(nu,{size:15}),label:"Points Awarded",value:e?"—":J0(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((v,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:v.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:v.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:v.accent,flexShrink:0,marginTop:"2px"},children:v.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:v.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"3px",lineHeight:"1.3"},children:v.label}),v.trend&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:v.trendUp?"#16a34a":"var(--muted)",marginTop:"6px",lineHeight:"1.2"},children:v.trend})]})]},m))})}var rk,uR;function vs(){if(uR)return rk;uR=1;var e=Array.isArray;return rk=e,rk}var nk,dR;function dH(){if(dR)return nk;dR=1;var e=typeof L0=="object"&&L0&&L0.Object===Object&&L0;return nk=e,nk}var ik,fR;function du(){if(fR)return ik;fR=1;var e=dH(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ik=r,ik}var ok,pR;function Ib(){if(pR)return ok;pR=1;var e=du(),t=e.Symbol;return ok=t,ok}var ak,hR;function Ele(){if(hR)return ak;hR=1;var e=Ib(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function a(s){var l=r.call(s,o),c=s[o];try{s[o]=void 0;var u=!0}catch{}var d=n.call(s);return u&&(l?s[o]=c:delete s[o]),d}return ak=a,ak}var sk,gR;function Ale(){if(gR)return sk;gR=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return sk=r,sk}var lk,mR;function Td(){if(mR)return lk;mR=1;var e=Ib(),t=Ele(),r=Ale(),n="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?o:n:a&&a in Object(l)?t(l):r(l)}return lk=s,lk}var ck,vR;function Pd(){if(vR)return ck;vR=1;function e(t){return t!=null&&typeof t=="object"}return ck=e,ck}var uk,yR;function Cv(){if(yR)return uk;yR=1;var e=Td(),t=Pd(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return uk=n,uk}var dk,xR;function $T(){if(xR)return dk;xR=1;var e=vs(),t=Cv(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(a,s){if(e(a))return!1;var l=typeof a;return l=="number"||l=="symbol"||l=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return dk=o,dk}var fk,bR;function Jf(){if(bR)return fk;bR=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return fk=e,fk}var pk,wR;function UT(){if(wR)return pk;wR=1;var e=Td(),t=Jf(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function s(l){if(!t(l))return!1;var c=e(l);return c==n||c==o||c==r||c==a}return pk=s,pk}var hk,SR;function Tle(){if(SR)return hk;SR=1;var e=du(),t=e["__core-js_shared__"];return hk=t,hk}var gk,jR;function Ple(){if(jR)return gk;jR=1;var e=Tle(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return gk=r,gk}var mk,kR;function fH(){if(kR)return mk;kR=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return mk=r,mk}var vk,_R;function Ile(){if(_R)return vk;_R=1;var e=UT(),t=Ple(),r=Jf(),n=fH(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(h){if(!r(h)||t(h))return!1;var p=e(h)?d:a;return p.test(n(h))}return vk=f,vk}var yk,CR;function Ole(){if(CR)return yk;CR=1;function e(t,r){return t==null?void 0:t[r]}return yk=e,yk}var xk,ER;function Vh(){if(ER)return xk;ER=1;var e=Ile(),t=Ole();function r(n,o){var a=t(n,o);return e(a)?a:void 0}return xk=r,xk}var bk,AR;function mS(){if(AR)return bk;AR=1;var e=Vh(),t=e(Object,"create");return bk=t,bk}var wk,TR;function Nle(){if(TR)return wk;TR=1;var e=mS();function t(){this.__data__=e?e(null):{},this.size=0}return wk=t,wk}var Sk,PR;function Rle(){if(PR)return Sk;PR=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Sk=e,Sk}var jk,IR;function Lle(){if(IR)return jk;IR=1;var e=mS(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(a){var s=this.__data__;if(e){var l=s[a];return l===t?void 0:l}return n.call(s,a)?s[a]:void 0}return jk=o,jk}var kk,OR;function Fle(){if(OR)return kk;OR=1;var e=mS(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return kk=n,kk}var _k,NR;function zle(){if(NR)return _k;NR=1;var e=mS(),t="__lodash_hash_undefined__";function r(n,o){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&o===void 0?t:o,this}return _k=r,_k}var Ck,RR;function Mle(){if(RR)return Ck;RR=1;var e=Nle(),t=Rle(),r=Lle(),n=Fle(),o=zle();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l-1}return Ok=t,Ok}var Nk,WR;function $le(){if(WR)return Nk;WR=1;var e=vS();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 Nk=t,Nk}var Rk,qR;function yS(){if(qR)return Rk;qR=1;var e=Dle(),t=Ble(),r=Wle(),n=qle(),o=$le();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l0?1:-1},lh=function(t){return Ob(t)&&t.indexOf("%")===t.length-1},qt=function(t){return fce(t)&&!Nb(t)},mo=function(t){return qt(t)||Ob(t)},pce=0,Av=function(t){var r=++pce;return"".concat(t||"").concat(r)},Ua=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(!qt(t)&&!Ob(t))return n;var a;if(lh(t)){var s=t.indexOf("%");a=r*parseFloat(t.slice(0,s))/100}else a=+t;return Nb(a)&&(a=n),o&&a>r&&(a=r),a},Cf=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},hce=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 bce(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 V3(e){"@babel/helpers - typeof";return V3=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},V3(e)}var mL={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"},pd=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},vL=null,a_=null,XT=function e(t){if(t===vL&&Array.isArray(a_))return a_;var r=[];return S.Children.forEach(t,function(n){Rr(n)||(lce.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),a_=r,vL=t,r};function Ks(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(o){return pd(o)}):n=[pd(t)],XT(e).forEach(function(o){var a=Gs(o,"type.displayName")||Gs(o,"type.name");n.indexOf(a)!==-1&&r.push(o)}),r}function qs(e,t){var r=Ks(e,t);return r&&r[0]}var yL=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,o=r.height;return!(!qt(n)||n<=0||!qt(o)||o<=0)},wce=["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"],Sce=function(t){return t&&t.type&&Ob(t.type)&&wce.indexOf(t.type)>=0},jce=function(t){return t&&V3(t)==="object"&&"clipDot"in t},kce=function(t,r,n,o){var a,s=(a=o_==null?void 0:o_[o])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!Ar(t)&&(o&&s.includes(r)||mce.includes(r))||n&&QT.includes(r)},yr=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var o=t;if(S.isValidElement(t)&&(o=t.props),!Ev(o))return null;var a={};return Object.keys(o).forEach(function(s){var l;kce((l=o)===null||l===void 0?void 0:l[s],s,r,n)&&(a[s]=o[s])}),a},Y3=function e(t,r){if(t===r)return!0;var n=S.Children.count(t);if(n!==S.Children.count(r))return!1;if(n===0)return!0;if(n===1)return xL(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 Tce(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 K3(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=Ace(e,Ece),d=o||{width:r,height:n,x:0,y:0},f=Fr("recharts-surface",a);return $e.createElement("svg",G3({},yr(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),$e.createElement("title",null,l),$e.createElement("desc",null,c),t)}var Pce=["children","className"];function Q3(){return Q3=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 Oce(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 cn=$e.forwardRef(function(e,t){var r=e.children,n=e.className,o=Ice(e,Pce),a=Fr("recharts-layer",n);return $e.createElement("g",Q3({className:a},yr(o,!0),{ref:t}),r)}),dc=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 l_=t,l_}var c_,jL;function yH(){if(jL)return c_;jL=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 c_=c,c_}var u_,kL;function Lce(){if(kL)return u_;kL=1;function e(t){return t.split("")}return u_=e,u_}var d_,_L;function Fce(){if(_L)return d_;_L=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",v=u+"?",m="["+a+"]?",b="(?:"+p+"(?:"+[d,f,h].join("|")+")"+m+v+")*",x=m+v+b,w="(?:"+[d+l+"?",l,f,h,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+w+x,"g");function j(_){return _.match(k)||[]}return d_=j,d_}var f_,CL;function zce(){if(CL)return f_;CL=1;var e=Lce(),t=yH(),r=Fce();function n(o){return t(o)?r(o):e(o)}return f_=n,f_}var p_,EL;function Mce(){if(EL)return p_;EL=1;var e=Rce(),t=yH(),r=zce(),n=hH();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 p_=o,p_}var h_,AL;function Dce(){if(AL)return h_;AL=1;var e=Mce(),t=e("toUpperCase");return h_=t,h_}var Bce=Dce();const wS=dn(Bce);function Gn(e){return function(){return e}}const xH=Math.cos,x2=Math.sin,Sc=Math.sqrt,b2=Math.PI,SS=2*b2,X3=Math.PI,Z3=2*X3,Qp=1e-6,Wce=Z3-Qp;function bH(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return bH;const r=10**t;return function(n){this._+=n[0];for(let o=1,a=n.length;oQp)if(!(Math.abs(f*c-u*d)>Qp)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,v=o-l,m=c*c+u*u,b=p*p+v*v,x=Math.sqrt(m),w=Math.sqrt(h),k=a*Math.tan((X3-Math.acos((m+h-b)/(2*x*w)))/2),j=k/w,_=k/x;Math.abs(j-1)>Qp&&this._append`L${t+j*d},${r+j*f}`,this._append`A${a},${a},0,0,${+(f*p>d*v)},${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)>Qp||Math.abs(this._y1-d)>Qp)&&this._append`L${u},${d}`,n&&(h<0&&(h=h%Z3+Z3),h>Wce?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>Qp&&this._append`A${n},${n},0,${+(h>=X3)},${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 ZT(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 $ce(t)}function JT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wH(e){this._context=e}wH.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 jS(e){return new wH(e)}function SH(e){return e[0]}function jH(e){return e[1]}function kH(e,t){var r=Gn(!0),n=null,o=jS,a=null,s=ZT(l);e=typeof e=="function"?e:e===void 0?SH:Gn(e),t=typeof t=="function"?t:t===void 0?jH:Gn(t);function l(c){var u,d=(c=JT(c)).length,f,h=!1,p;for(n==null&&(a=o(p=s())),u=0;u<=d;++u)!(u=p;--v)l.point(k[v],j[v]);l.lineEnd(),l.areaEnd()}x&&(k[h]=+e(b,h,f),j[h]=+t(b,h,f),l.point(n?+n(b,h,f):k[h],r?+r(b,h,f):j[h]))}if(w)return l=null,w+""||null}function d(){return kH().defined(o).curve(s).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Gn(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Gn(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Gn(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Gn(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Gn(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Gn(+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:Gn(!!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 _H{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 Uce(e){return new _H(e,!0)}function Hce(e){return new _H(e,!1)}const eP={draw(e,t){const r=Sc(t/b2);e.moveTo(r,0),e.arc(0,0,r,0,SS)}},Vce={draw(e,t){const r=Sc(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()}},CH=Sc(1/3),Yce=CH*2,Gce={draw(e,t){const r=Sc(t/Yce),n=r*CH;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Kce={draw(e,t){const r=Sc(t),n=-r/2;e.rect(n,n,r,r)}},Qce=.8908130915292852,EH=x2(b2/10)/x2(7*b2/10),Xce=x2(SS/10)*EH,Zce=-xH(SS/10)*EH,Jce={draw(e,t){const r=Sc(t*Qce),n=Xce*r,o=Zce*r;e.moveTo(0,-r),e.lineTo(n,o);for(let a=1;a<5;++a){const s=SS*a/5,l=xH(s),c=x2(s);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*o,c*n+l*o)}e.closePath()}},g_=Sc(3),eue={draw(e,t){const r=-Sc(t/(g_*3));e.moveTo(0,r*2),e.lineTo(-g_*r,-r),e.lineTo(g_*r,-r),e.closePath()}},wl=-.5,Sl=Sc(3)/2,J3=1/Sc(12),tue=(J3/2+1)*3,rue={draw(e,t){const r=Sc(t/tue),n=r/2,o=r*J3,a=n,s=r*J3+r,l=-a,c=s;e.moveTo(n,o),e.lineTo(a,s),e.lineTo(l,c),e.lineTo(wl*n-Sl*o,Sl*n+wl*o),e.lineTo(wl*a-Sl*s,Sl*a+wl*s),e.lineTo(wl*l-Sl*c,Sl*l+wl*c),e.lineTo(wl*n+Sl*o,wl*o-Sl*n),e.lineTo(wl*a+Sl*s,wl*s-Sl*a),e.lineTo(wl*l+Sl*c,wl*c-Sl*l),e.closePath()}};function nue(e,t){let r=null,n=ZT(o);e=typeof e=="function"?e:Gn(e||eP),t=typeof t=="function"?t:Gn(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:Gn(a),o):e},o.size=function(a){return arguments.length?(t=typeof a=="function"?a:Gn(+a),o):t},o.context=function(a){return arguments.length?(r=a??null,o):r},o}function w2(){}function S2(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 AH(e){this._context=e}AH.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:S2(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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function iue(e){return new AH(e)}function TH(e){this._context=e}TH.prototype={areaStart:w2,areaEnd:w2,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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oue(e){return new TH(e)}function PH(e){this._context=e}PH.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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function aue(e){return new PH(e)}function IH(e){this._context=e}IH.prototype={areaStart:w2,areaEnd:w2,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 sue(e){return new IH(e)}function TL(e){return e<0?-1:1}function PL(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(TL(a)+TL(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function IL(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function m_(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 j2(e){this._context=e}j2.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:m_(this,this._t0,IL(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,m_(this,IL(this,r=PL(this,e,t)),r);break;default:m_(this,this._t0,r=PL(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function OH(e){this._context=new NH(e)}(OH.prototype=Object.create(j2.prototype)).point=function(e,t){j2.prototype.point.call(this,t,e)};function NH(e){this._context=e}NH.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 lue(e){return new j2(e)}function cue(e){return new OH(e)}function RH(e){this._context=e}RH.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=OL(e),o=OL(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 due(e){return new kS(e,.5)}function fue(e){return new kS(e,0)}function pue(e){return new kS(e,1)}function Lm(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 hue(e,t){return e[t]}function gue(e){const t=[];return t.key=e,t}function mue(){var e=Gn([]),t=eA,r=Lm,n=hue;function o(a){var s=Array.from(e.apply(this,arguments),gue),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 _ue(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 LH={symbolCircle:eP,symbolCross:Vce,symbolDiamond:Gce,symbolSquare:Kce,symbolStar:Jce,symbolTriangle:eue,symbolWye:rue},Cue=Math.PI/180,Eue=function(t){var r="symbol".concat(wS(t));return LH[r]||eP},Aue=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*Cue;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}},Tue=function(t,r){LH["symbol".concat(wS(t))]=r},tP=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=kue(t,bue),u=RL(RL({},c),{},{type:n,size:a,sizeType:l}),d=function(){var b=Eue(n),x=nue().type(b).size(Aue(a,l,n));return x()},f=u.className,h=u.cx,p=u.cy,v=yr(u,!0);return h===+h&&p===+p&&a===+a?$e.createElement("path",tA({},v,{className:Fr("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};tP.registerSymbol=Tue;function Fm(e){"@babel/helpers - typeof";return Fm=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},Fm(e)}function rA(){return rA=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var w=p.inactive?u:p.color;return $e.createElement("li",rA({className:b,style:f,key:"legend-item-".concat(v)},Eh(n.props,p,v)),$e.createElement(K3,{width:s,height:s,viewBox:d,style:h},n.renderIcon(p)),$e.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},m?m(x,p,v):x))})}},{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 $e.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])})(S.PureComponent);Px(rP,"displayName","Legend");Px(rP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var v_,FL;function Due(){if(FL)return v_;FL=1;var e=yS();function t(){this.__data__=new e,this.size=0}return v_=t,v_}var y_,zL;function Bue(){if(zL)return y_;zL=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return y_=e,y_}var x_,ML;function Wue(){if(ML)return x_;ML=1;function e(t){return this.__data__.get(t)}return x_=e,x_}var b_,DL;function que(){if(DL)return b_;DL=1;function e(t){return this.__data__.has(t)}return b_=e,b_}var w_,BL;function $ue(){if(BL)return w_;BL=1;var e=yS(),t=VT(),r=YT(),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),b=f.get(l);if(m&&b)return m==l&&b==s;var x=-1,w=!0,k=c&o?new e:void 0;for(f.set(s,l),f.set(l,s);++x-1&&n%1==0&&n-1&&r%1==0&&r<=e}return $_=t,$_}var U_,uF;function rde(){if(uF)return U_;uF=1;var e=Td(),t=aP(),r=Pd(),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]",v="[object String]",m="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",w="[object Float32Array]",k="[object Float64Array]",j="[object Int8Array]",_="[object Int16Array]",T="[object Int32Array]",A="[object Uint8Array]",P="[object Uint8ClampedArray]",N="[object Uint16Array]",O="[object Uint32Array]",C={};C[w]=C[k]=C[j]=C[_]=C[T]=C[A]=C[P]=C[N]=C[O]=!0,C[n]=C[o]=C[b]=C[a]=C[x]=C[s]=C[l]=C[c]=C[u]=C[d]=C[f]=C[h]=C[p]=C[v]=C[m]=!1;function I(R){return r(R)&&t(R.length)&&!!C[e(R)]}return U_=I,U_}var H_,dF;function HH(){if(dF)return H_;dF=1;function e(t){return function(r){return t(r)}}return H_=e,H_}var Xy={exports:{}};Xy.exports;var fF;function nde(){return fF||(fF=1,(function(e,t){var r=dH(),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})(Xy,Xy.exports)),Xy.exports}var V_,pF;function VH(){if(pF)return V_;pF=1;var e=rde(),t=HH(),r=nde(),n=r&&r.isTypedArray,o=n?t(n):e;return V_=o,V_}var Y_,hF;function ide(){if(hF)return Y_;hF=1;var e=Jue(),t=iP(),r=vs(),n=UH(),o=oP(),a=VH(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=r(u),h=!f&&t(u),p=!f&&!h&&n(u),v=!f&&!h&&!p&&a(u),m=f||h||p||v,b=m?e(u.length,String):[],x=b.length;for(var w in u)(d||l.call(u,w))&&!(m&&(w=="length"||p&&(w=="offset"||w=="parent")||v&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||o(w,x)))&&b.push(w);return b}return Y_=c,Y_}var G_,gF;function ode(){if(gF)return G_;gF=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return G_=t,G_}var K_,mF;function YH(){if(mF)return K_;mF=1;function e(t,r){return function(n){return t(r(n))}}return K_=e,K_}var Q_,vF;function ade(){if(vF)return Q_;vF=1;var e=YH(),t=e(Object.keys,Object);return Q_=t,Q_}var X_,yF;function sde(){if(yF)return X_;yF=1;var e=ode(),t=ade(),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 X_=o,X_}var Z_,xF;function Rb(){if(xF)return Z_;xF=1;var e=UT(),t=aP();function r(n){return n!=null&&t(n.length)&&!e(n)}return Z_=r,Z_}var J_,bF;function _S(){if(bF)return J_;bF=1;var e=ide(),t=sde(),r=Rb();function n(o){return r(o)?e(o):t(o)}return J_=n,J_}var eC,wF;function lde(){if(wF)return eC;wF=1;var e=Kue(),t=Zue(),r=_S();function n(o){return e(o,r,t)}return eC=n,eC}var tC,SF;function cde(){if(SF)return tC;SF=1;var e=lde(),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,v=e(s),m=v.length;if(p!=m&&!f)return!1;for(var b=p;b--;){var x=h[b];if(!(f?x in s:n.call(s,x)))return!1}var w=d.get(a),k=d.get(s);if(w&&k)return w==s&&k==a;var j=!0;d.set(a,s),d.set(s,a);for(var _=f;++b-1}return EC=t,EC}var AC,KF;function Tde(){if(KF)return AC;KF=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o=s){var x=u?null:o(c);if(x)return a(x);v=!1,h=n,b=new e}else b=u?[]:m;e:for(;++f=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ude(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 Hde(e){return e.value}function Vde(e,t){if($e.isValidElement(e))return $e.cloneElement(e,t);if(typeof e=="function")return $e.createElement(e,t);t.ref;var r=$de(t,Lde);return $e.createElement(rP,r)}var nz=1,Ff=(function(e){function t(){var r;Fde(this,t);for(var n=arguments.length,o=new Array(n),a=0;anz||Math.abs(o.height-this.lastBoundingBox.height)>nz)&&(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?Yu({},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 v=this.getBBoxSnapshot();h={top:((d||0)-v.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Yu(Yu({},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=Yu(Yu({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return $e.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},Vde(a,Yu(Yu({},this.props),{},{payload:ZH(d,u,Hde)})))}}],[{key:"getWithHeight",value:function(n,o){var a=Yu(Yu({},this.defaultProps),n.props),s=a.layout;return s==="vertical"&&qt(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||o}:null}}])})(S.PureComponent);CS(Ff,"displayName","Legend");CS(Ff,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var NC,iz;function Yde(){if(iz)return NC;iz=1;var e=Ib(),t=iP(),r=vs(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return NC=o,NC}var RC,oz;function tV(){if(oz)return RC;oz=1;var e=$H(),t=Yde();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 RC=r,RC}var LC,az;function Gde(){if(az)return LC;az=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 LC=e,LC}var FC,sz;function Kde(){if(sz)return FC;sz=1;var e=Gde(),t=e();return FC=t,FC}var zC,lz;function rV(){if(lz)return zC;lz=1;var e=Kde(),t=_S();function r(n,o){return n&&e(n,o,t)}return zC=r,zC}var MC,cz;function Qde(){if(cz)return MC;cz=1;var e=Rb();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 $C=t,$C}var UC,gz;function efe(){if(gz)return UC;gz=1;var e=GT(),t=KT(),r=fu(),n=nV(),o=Xde(),a=HH(),s=Jde(),l=Tv(),c=vs();function u(d,f,h){f.length?f=e(f,function(m){return c(m)?function(b){return t(b,m.length===1?m[0]:m)}:m}):f=[l];var p=-1;f=e(f,a(r));var v=n(d,function(m,b,x){var w=e(f,function(k){return k(m)});return{criteria:w,index:++p,value:m}});return o(v,function(m,b){return s(m,b,h)})}return UC=u,UC}var HC,mz;function tfe(){if(mz)return HC;mz=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 HC=e,HC}var VC,vz;function rfe(){if(vz)return VC;vz=1;var e=tfe(),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 QC=n,QC}var XC,Sz;function afe(){if(Sz)return XC;Sz=1;var e=ife(),t=ofe(),r=t(e);return XC=r,XC}var ZC,jz;function sfe(){if(jz)return ZC;jz=1;var e=Tv(),t=rfe(),r=afe();function n(o,a){return r(t(o,a,e),o+"")}return ZC=n,ZC}var JC,kz;function ES(){if(kz)return JC;kz=1;var e=HT(),t=Rb(),r=oP(),n=Jf();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 JC=o,JC}var e4,_z;function lfe(){if(_z)return e4;_z=1;var e=tV(),t=efe(),r=sfe(),n=ES(),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 e4=o,e4}var cfe=lfe();const cP=dn(cfe);function Ix(e){"@babel/helpers - typeof";return Ix=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},Ix(e)}function oA(){return oA=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(wy,"-left"),qt(r)&&t&&qt(t.x)&&r=t.y),"".concat(wy,"-top"),qt(n)&&t&&qt(t.y)&&nm?Math.max(d,c[n]):Math.max(f,c[n])}function kfe(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 _fe(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=Az({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=Az({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=kfe({translateX:d,translateY:f,useTranslate3d:l})):u=Sfe,{cssProperties:u,cssClasses:jfe({translateX:d,translateY:f,coordinate:r})}}function Mm(e){"@babel/helpers - typeof";return Mm=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},Mm(e)}function Tz(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 Pz(e){for(var t=1;tIz||Math.abs(n.height-this.state.lastBoundingBox.height)>Iz)&&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,v=o.position,m=o.reverseDirection,b=o.useTranslate3d,x=o.viewBox,w=o.wrapperStyle,k=_fe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:v,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:x}),j=k.cssClasses,_=k.cssProperties,T=Pz(Pz({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 $e.createElement("div",{tabIndex:-1,className:j,style:T,ref:function(P){n.wrapperNode=P}},u)}}])})(S.PureComponent),Lfe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Yh={isSsr:Lfe()};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 Oz(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 Nz(e){for(var t=1;t0;return $e.createElement(Rfe,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:h,active:a,coordinate:d,hasPayload:T,offset:p,position:b,reverseDirection:x,useTranslate3d:w,viewBox:k,wrapperStyle:j},Hfe(u,Nz(Nz({},this.props),{},{payload:_})))}}])})(S.PureComponent);uP(Tl,"displayName","Tooltip");uP(Tl,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Yh.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 r4,Rz;function Vfe(){if(Rz)return r4;Rz=1;var e=du(),t=function(){return e.Date.now()};return r4=t,r4}var n4,Lz;function Yfe(){if(Lz)return n4;Lz=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return n4=t,n4}var i4,Fz;function Gfe(){if(Fz)return i4;Fz=1;var e=Yfe(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return i4=r,i4}var o4,zz;function cV(){if(zz)return o4;zz=1;var e=Gfe(),t=Jf(),r=Cv(),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 o4=c,o4}var a4,Mz;function Kfe(){if(Mz)return a4;Mz=1;var e=Jf(),t=Vfe(),r=cV(),n="Expected a function",o=Math.max,a=Math.min;function s(l,c,u){var d,f,h,p,v,m,b=0,x=!1,w=!1,k=!0;if(typeof l!="function")throw new TypeError(n);c=r(c)||0,e(u)&&(x=!!u.leading,w="maxWait"in u,h=w?o(r(u.maxWait)||0,c):h,k="trailing"in u?!!u.trailing:k);function j(R){var F=d,M=f;return d=f=void 0,b=R,p=l.apply(M,F),p}function _(R){return b=R,v=setTimeout(P,c),x?j(R):p}function T(R){var F=R-m,M=R-b,Y=c-F;return w?a(Y,h-M):Y}function A(R){var F=R-m,M=R-b;return m===void 0||F>=c||F<0||w&&M>=h}function P(){var R=t();if(A(R))return N(R);v=setTimeout(P,T(R))}function N(R){return v=void 0,k&&d?j(R):(d=f=void 0,p)}function O(){v!==void 0&&clearTimeout(v),b=0,d=m=f=v=void 0}function C(){return v===void 0?p:N(t())}function I(){var R=t(),F=A(R);if(d=arguments,f=this,m=R,F){if(v===void 0)return _(m);if(w)return clearTimeout(v),v=setTimeout(P,c),j(m)}return v===void 0&&(v=setTimeout(P,c)),p}return I.cancel=O,I.flush=C,I}return a4=s,a4}var s4,Dz;function Qfe(){if(Dz)return s4;Dz=1;var e=Kfe(),t=Jf(),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 s4=n,s4}var Xfe=Qfe();const uV=dn(Xfe);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 Bz(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 r1(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(R=uV(R,m,{trailing:!0,leading:!1}));var F=new ResizeObserver(R),M=_.current.getBoundingClientRect(),Y=M.width,X=M.height;return C(Y,X),F.observe(_.current),function(){F.disconnect()}},[C,m]);var I=S.useMemo(function(){var R=N.containerWidth,F=N.containerHeight;if(R<0||F<0)return null;dc(lh(s)||lh(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,c),dc(!r||r>0,"The aspect(%s) must be greater than zero.",r);var M=lh(s)?R:s,Y=lh(c)?F:c;r&&r>0&&(M?Y=M/r:Y&&(M=Y*r),h&&Y>h&&(Y=h)),dc(M>0||Y>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.`,M,Y,s,c,d,f,r);var X=!Array.isArray(p)&&pd(p.type).endsWith("Chart");return $e.Children.map(p,function($){return $e.isValidElement($)?S.cloneElement($,r1({width:M,height:Y},X?{style:r1({height:"100%",width:"100%",maxHeight:Y,maxWidth:M},$.props.style)}:{})):$})},[r,p,c,h,f,d,N,s]);return $e.createElement("div",{id:b?"".concat(b):void 0,className:Fr("recharts-responsive-container",x),style:r1(r1({},j),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:_},I)}),AS=function(t){return null};AS.displayName="Cell";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 qz(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 cA(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Yh.isSsr)return{width:0,height:0};var n=dpe(r),o=JSON.stringify({text:t,copyStyle:n});if(Mg.widthCache[o])return Mg.widthCache[o];try{var a=document.getElementById($z);a||(a=document.createElement("span"),a.setAttribute("id",$z),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var s=cA(cA({},upe),n);Object.assign(a.style,s),a.textContent="".concat(t);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return Mg.widthCache[o]=c,++Mg.cacheCount>cpe&&(Mg.cacheCount=0,Mg.widthCache={}),c}catch{return{width:0,height:0}}},fpe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Lx(e){"@babel/helpers - typeof";return Lx=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},Lx(e)}function A2(e,t){return mpe(e)||gpe(e,t)||hpe(e,t)||ppe()}function ppe(){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 hpe(e,t){if(e){if(typeof e=="string")return Uz(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 Uz(e,t)}}function Uz(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 Ppe(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 Qz(e,t){return Rpe(e)||Npe(e,t)||Ope(e,t)||Ipe()}function Ipe(){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 Ope(e,t){if(e){if(typeof e=="string")return Xz(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 Xz(e,t)}}function Xz(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 M.reduce(function(Y,X){var $=X.word,ee=X.width,V=Y[Y.length-1];if(V&&(o==null||a||V.width+ee+nX.width?Y:X})};if(!d)return p;for(var m="…",b=function(M){var Y=f.slice(0,M),X=hV({breakAll:u,style:c,children:Y+m}).wordsWithComputedWidth,$=h(X),ee=$.length>s||v($).width>Number(o);return[ee,$]},x=0,w=f.length-1,k=0,j;x<=w&&k<=f.length-1;){var _=Math.floor((x+w)/2),T=_-1,A=b(T),P=Qz(A,2),N=P[0],O=P[1],C=b(_),I=Qz(C,1),R=I[0];if(!N&&!R&&(x=_+1),N&&R&&(w=_-1),!N&&R){j=O;break}k++}return j||p},Zz=function(t){var r=Rr(t)?[]:t.toString().split(pV);return[{words:r}]},Fpe=function(t){var r=t.width,n=t.scaleToFit,o=t.children,a=t.style,s=t.breakAll,l=t.maxLines;if((r||n)&&!Yh.isSsr){var c,u,d=hV({breakAll:s,children:o,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return Zz(o);return Lpe({breakAll:s,children:o,maxLines:l,style:a},c,u,r,n)}return Zz(o)},Jz="#808080",Ah=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,v=t.verticalAnchor,m=v===void 0?"end":v,b=t.fill,x=b===void 0?Jz:b,w=Kz(t,Ape),k=S.useMemo(function(){return Fpe({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]),j=w.dx,_=w.dy,T=w.angle,A=w.className,P=w.breakAll,N=Kz(w,Tpe);if(!mo(n)||!mo(a))return null;var O=n+(qt(j)?j:0),C=a+(qt(_)?_:0),I;switch(m){case"start":I=c4("calc(".concat(u,")"));break;case"middle":I=c4("calc(".concat((k.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:I=c4("calc(".concat(k.length-1," * -").concat(l,")"));break}var R=[];if(f){var F=k[0].width,M=w.width;R.push("scale(".concat((qt(M)?M/F:1)/F,")"))}return T&&R.push("rotate(".concat(T,", ").concat(O,", ").concat(C,")")),R.length&&(N.transform=R.join(" ")),$e.createElement("text",uA({},yr(N,!0),{x:O,y:C,className:Fr("recharts-text",A),textAnchor:p,fill:x.includes("url")?Jz:x}),k.map(function(Y,X){var $=Y.words.join(P?"":" ");return $e.createElement("tspan",{x:O,dy:X===0?I:l,key:"".concat($,"-").concat(X)},$)}))};function zf(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function zpe(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function dP(e){let t,r,n;e.length!==2?(t=zf,r=(l,c)=>zf(e(l),c),n=(l,c)=>e(l)-c):(t=e===zf||e===zpe?e:Mpe,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 Mpe(){return 0}function gV(e){return e===null?NaN:+e}function*Dpe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Bpe=dP(zf),Lb=Bpe.right;dP(gV).center;class eM extends Map{constructor(t,r=$pe){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(tM(this,t))}has(t){return super.has(tM(this,t))}set(t,r){return super.set(Wpe(this,t),r)}delete(t){return super.delete(qpe(this,t))}}function tM({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Wpe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function qpe({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function $pe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Upe(e=zf){if(e===zf)return mV;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 mV(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Hpe=Math.sqrt(50),Vpe=Math.sqrt(10),Ype=Math.sqrt(2);function T2(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>=Hpe?10:a>=Vpe?5:a>=Ype?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 nM(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function vV(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?mV:Upe(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)),v=Math.min(n,Math.floor(t+(c-u)*f/c+h));vV(e,t,p,v,o)}const a=e[t];let s=r,l=n;for(Sy(e,r,t),o(e[n],a)>0&&Sy(e,r,n);s0;)--l}o(e[r],a)===0?Sy(e,r,l):(++l,Sy(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Sy(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Gpe(e,t,r){if(e=Float64Array.from(Dpe(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return nM(e);if(t>=1)return rM(e);var n,o=(n-1)*t,a=Math.floor(o),s=rM(vV(e,a).subarray(0,a+1)),l=nM(e.subarray(a+1));return s+(l-s)*(o-a)}}function Kpe(e,t,r=gV){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 Qpe(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?i1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?i1(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=Zpe.exec(e))?new us(t[1],t[2],t[3],1):(t=Jpe.exec(e))?new us(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ehe.exec(e))?i1(t[1],t[2],t[3],t[4]):(t=the.exec(e))?i1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=rhe.exec(e))?uM(t[1],t[2]/100,t[3]/100,1):(t=nhe.exec(e))?uM(t[1],t[2]/100,t[3]/100,t[4]):iM.hasOwnProperty(e)?sM(iM[e]):e==="transparent"?new us(NaN,NaN,NaN,0):null}function sM(e){return new us(e>>16&255,e>>8&255,e&255,1)}function i1(e,t,r,n){return n<=0&&(e=t=r=NaN),new us(e,t,r,n)}function ahe(e){return e instanceof Fb||(e=Dx(e)),e?(e=e.rgb(),new us(e.r,e.g,e.b,e.opacity)):new us}function gA(e,t,r,n){return arguments.length===1?ahe(e):new us(e,t,r,n??1)}function us(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}pP(us,gA,xV(Fb,{brighter(e){return e=e==null?P2:Math.pow(P2,e),new us(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zx:Math.pow(zx,e),new us(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new us(mh(this.r),mh(this.g),mh(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:lM,formatHex:lM,formatHex8:she,formatRgb:cM,toString:cM}));function lM(){return`#${ch(this.r)}${ch(this.g)}${ch(this.b)}`}function she(){return`#${ch(this.r)}${ch(this.g)}${ch(this.b)}${ch((isNaN(this.opacity)?1:this.opacity)*255)}`}function cM(){const e=I2(this.opacity);return`${e===1?"rgb(":"rgba("}${mh(this.r)}, ${mh(this.g)}, ${mh(this.b)}${e===1?")":`, ${e})`}`}function I2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function mh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ch(e){return e=mh(e),(e<16?"0":"")+e.toString(16)}function uM(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new oc(e,t,r,n)}function bV(e){if(e instanceof oc)return new oc(e.h,e.s,e.l,e.opacity);if(e instanceof Fb||(e=Dx(e)),!e)return new oc;if(e instanceof oc)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 oc(s,l,c,e.opacity)}function lhe(e,t,r,n){return arguments.length===1?bV(e):new oc(e,t,r,n??1)}function oc(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}pP(oc,lhe,xV(Fb,{brighter(e){return e=e==null?P2:Math.pow(P2,e),new oc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zx:Math.pow(zx,e),new oc(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 us(u4(e>=240?e-240:e+120,o,n),u4(e,o,n),u4(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new oc(dM(this.h),o1(this.s),o1(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("}${dM(this.h)}, ${o1(this.s)*100}%, ${o1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dM(e){return e=(e||0)%360,e<0?e+360:e}function o1(e){return Math.max(0,Math.min(1,e||0))}function u4(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 hP=e=>()=>e;function che(e,t){return function(r){return e+r*t}}function uhe(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 dhe(e){return(e=+e)==1?wV:function(t,r){return r-t?uhe(t,r,e):hP(isNaN(t)?r:t)}}function wV(e,t){var r=t-e;return r?che(e,r):hP(isNaN(e)?t:e)}const fM=(function e(t){var r=dhe(t);function n(o,a){var s=r((o=gA(o)).r,(a=gA(a)).r),l=r(o.g,a.g),c=r(o.b,a.b),u=wV(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 fhe(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=d4.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function jhe(e,t,r){var n=e[0],o=e[1],a=t[0],s=t[1];return o2?khe:jhe,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,N2),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=gP,d()},f.clamp=function(h){return arguments.length?(s=h?!0:Ha,d()):s!==Ha},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 mP(){return TS()(Ha,Ha)}function _he(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function R2(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 Bm(e){return e=R2(Math.abs(e)),e?e[1]:NaN}function Che(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 Ehe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Ahe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Bx(e){if(!(t=Ahe.exec(e)))throw new Error("invalid format: "+e);var t;return new vP({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]})}Bx.prototype=vP.prototype;function vP(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+""}vP.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 The(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 Phe(e,t){var r=R2(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")+R2(e,Math.max(0,t+a-1))[0]}function hM(e,t){var r=R2(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 gM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:_he,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)=>hM(e*100,t),r:hM,s:Phe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function mM(e){return e}var vM=Array.prototype.map,yM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ihe(e){var t=e.grouping===void 0||e.thousands===void 0?mM:Che(vM.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?mM:Ehe(vM.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=Bx(f);var p=f.fill,v=f.align,m=f.sign,b=f.symbol,x=f.zero,w=f.width,k=f.comma,j=f.precision,_=f.trim,T=f.type;T==="n"?(k=!0,T="g"):gM[T]||(j===void 0&&(j=12),_=!0,T="g"),(x||p==="0"&&v==="=")&&(x=!0,p="0",v="=");var A=(h&&h.prefix!==void 0?h.prefix:"")+(b==="$"?r:b==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():""),P=(b==="$"?n:/[%p]/.test(T)?s:"")+(h&&h.suffix!==void 0?h.suffix:""),N=gM[T],O=/[defgprs%]/.test(T);j=j===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function C(I){var R=A,F=P,M,Y,X;if(T==="c")F=N(I)+F,I="";else{I=+I;var $=I<0||1/I<0;if(I=isNaN(I)?c:N(Math.abs(I),j),_&&(I=The(I)),$&&+I==0&&m!=="+"&&($=!1),R=($?m==="("?m:l:m==="-"||m==="("?"":m)+R,F=(T==="s"&&!isNaN(I)&&L2!==void 0?yM[8+L2/3]:"")+F+($&&m==="("?")":""),O){for(M=-1,Y=I.length;++MX||X>57){F=(X===46?o+I.slice(M+1):I.slice(M))+F,I=I.slice(0,M);break}}}k&&!x&&(I=t(I,1/0));var ee=R.length+I.length+F.length,V=ee>1)+R+I+F+V.slice(ee);break;default:I=V+R+I+F;break}return a(I)}return C.toString=function(){return f+""},C}function d(f,h){var p=Math.max(-8,Math.min(8,Math.floor(Bm(h)/3)))*3,v=Math.pow(10,-p),m=u((f=Bx(f),f.type="f",f),{suffix:yM[8+p/3]});return function(b){return m(v*b)}}return{format:u,formatPrefix:d}}var a1,yP,SV;Ohe({thousands:",",grouping:[3],currency:["$",""]});function Ohe(e){return a1=Ihe(e),yP=a1.format,SV=a1.formatPrefix,a1}function Nhe(e){return Math.max(0,-Bm(Math.abs(e)))}function Rhe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bm(t)/3)))*3-Bm(Math.abs(e)))}function Lhe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bm(t)-Bm(e))+1}function jV(e,t,r,n){var o=pA(e,t,r),a;switch(n=Bx(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=Rhe(o,s))&&(n.precision=a),SV(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=Lhe(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=Nhe(o))&&(n.precision=a-(n.type==="%")*2);break}}return yP(n)}function ep(e){var t=e.domain;return e.ticks=function(r){var n=t();return dA(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return jV(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=fA(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 F2(){var e=mP();return e.copy=function(){return zb(e,F2())},Ml.apply(e,arguments),ep(e)}function kV(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,N2),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return kV(e).unknown(t)},e=arguments.length?Array.from(e,N2):[0,1],ep(r)}function _V(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 Bhe(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 wM(e){return(t,r)=>-e(-t,r)}function xP(e){const t=e(xM,bM),r=t.domain;let n=10,o,a;function s(){return o=Bhe(n),a=Dhe(n),r()[0]<0?(o=wM(o),a=wM(a),e(Fhe,zhe)):e(xM,bM),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(v=1;vd)break;x.push(m)}}else for(;h<=p;++h)for(v=n-1;v>=1;--v)if(m=h>0?v/a(-h):v*a(h),!(md)break;x.push(m)}x.length*2{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Bx(c)).precision==null&&(c.trim=!0),c=yP(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(_V(r(),{floor:l=>a(Math.floor(o(l))),ceil:l=>a(Math.ceil(o(l)))})),t}function CV(){const e=xP(TS()).domain([1,10]);return e.copy=()=>zb(e,CV()).base(e.base()),Ml.apply(e,arguments),e}function SM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function jM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function bP(e){var t=1,r=e(SM(t),jM(t));return r.constant=function(n){return arguments.length?e(SM(t=+n),jM(t)):t},ep(r)}function EV(){var e=bP(TS());return e.copy=function(){return zb(e,EV()).constant(e.constant())},Ml.apply(e,arguments)}function kM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Whe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qhe(e){return e<0?-e*e:e*e}function wP(e){var t=e(Ha,Ha),r=1;function n(){return r===1?e(Ha,Ha):r===.5?e(Whe,qhe):e(kM(r),kM(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},ep(t)}function SP(){var e=wP(TS());return e.copy=function(){return zb(e,SP()).exponent(e.exponent())},Ml.apply(e,arguments),e}function $he(){return SP.apply(null,arguments).exponent(.5)}function _M(e){return Math.sign(e)*e*e}function Uhe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function AV(){var e=mP(),t=[0,1],r=!1,n;function o(a){var s=Uhe(e(a));return isNaN(s)?n:r?Math.round(s):s}return o.invert=function(a){return e.invert(_M(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,N2)).map(_M)),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 AV(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Ml.apply(o,arguments),ep(o)}function TV(){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 PV().domain([e,t]).range(o).unknown(a)},Ml.apply(ep(s),arguments)}function IV(){var e=[.5],t=[0,1],r,n=1;function o(a){return a!=null&&a<=a?t[Lb(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 IV().domain(e).range(t).unknown(r)},Ml.apply(o,arguments)}const f4=new Date,p4=new Date;function vo(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(uvo(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)=>(f4.setTime(+a),p4.setTime(+s),e(f4),e(p4),Math.floor(r(f4,p4))),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 z2=vo(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);z2.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?vo(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):z2);z2.range;const od=1e3,Il=od*60,ad=Il*60,yd=ad*24,jP=yd*7,CM=yd*30,h4=yd*365,uh=vo(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*od)},(e,t)=>(t-e)/od,e=>e.getUTCSeconds());uh.range;const kP=vo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*od)},(e,t)=>{e.setTime(+e+t*Il)},(e,t)=>(t-e)/Il,e=>e.getMinutes());kP.range;const _P=vo(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Il)},(e,t)=>(t-e)/Il,e=>e.getUTCMinutes());_P.range;const CP=vo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*od-e.getMinutes()*Il)},(e,t)=>{e.setTime(+e+t*ad)},(e,t)=>(t-e)/ad,e=>e.getHours());CP.range;const EP=vo(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ad)},(e,t)=>(t-e)/ad,e=>e.getUTCHours());EP.range;const Mb=vo(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Il)/yd,e=>e.getDate()-1);Mb.range;const PS=vo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yd,e=>e.getUTCDate()-1);PS.range;const OV=vo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yd,e=>Math.floor(e/yd));OV.range;function Gh(e){return vo(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())*Il)/jP)}const IS=Gh(0),M2=Gh(1),Hhe=Gh(2),Vhe=Gh(3),Wm=Gh(4),Yhe=Gh(5),Ghe=Gh(6);IS.range;M2.range;Hhe.range;Vhe.range;Wm.range;Yhe.range;Ghe.range;function Kh(e){return vo(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)/jP)}const OS=Kh(0),D2=Kh(1),Khe=Kh(2),Qhe=Kh(3),qm=Kh(4),Xhe=Kh(5),Zhe=Kh(6);OS.range;D2.range;Khe.range;Qhe.range;qm.range;Xhe.range;Zhe.range;const AP=vo(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());AP.range;const TP=vo(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());TP.range;const xd=vo(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());xd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:vo(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)});xd.range;const bd=vo(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());bd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:vo(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)});bd.range;function NV(e,t,r,n,o,a){const s=[[uh,1,od],[uh,5,5*od],[uh,15,15*od],[uh,30,30*od],[a,1,Il],[a,5,5*Il],[a,15,15*Il],[a,30,30*Il],[o,1,ad],[o,3,3*ad],[o,6,6*ad],[o,12,12*ad],[n,1,yd],[n,2,2*yd],[r,1,jP],[t,1,CM],[t,3,3*CM],[e,1,h4]];function l(u,d,f){const h=db).right(s,h);if(p===s.length)return e.every(pA(u/h4,d/h4,f));if(p===0)return z2.every(Math.max(pA(u,d,f),1));const[v,m]=s[h/s[p-1][2]53)return null;"w"in le||(le.w=1),"Z"in le?(ve=m4(jy(le.y,0,1)),se=ve.getUTCDay(),ve=se>4||se===0?D2.ceil(ve):D2(ve),ve=PS.offset(ve,(le.V-1)*7),le.y=ve.getUTCFullYear(),le.m=ve.getUTCMonth(),le.d=ve.getUTCDate()+(le.w+6)%7):(ve=g4(jy(le.y,0,1)),se=ve.getDay(),ve=se>4||se===0?M2.ceil(ve):M2(ve),ve=Mb.offset(ve,(le.V-1)*7),le.y=ve.getFullYear(),le.m=ve.getMonth(),le.d=ve.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),se="Z"in le?m4(jy(le.y,0,1)).getUTCDay():g4(jy(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(se+5)%7:le.w+le.U*7-(se+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,m4(le)):g4(le)}}function P(H,ie,de,le){for(var ke=0,ve=ie.length,se=de.length,be,De;ke=se)return-1;if(be=ie.charCodeAt(ke++),be===37){if(be=ie.charAt(ke++),De=_[be in EM?ie.charAt(ke++):be],!De||(le=De(H,de,le))<0)return-1}else if(be!=de.charCodeAt(le++))return-1}return le}function N(H,ie,de){var le=u.exec(ie.slice(de));return le?(H.p=d.get(le[0].toLowerCase()),de+le[0].length):-1}function O(H,ie,de){var le=p.exec(ie.slice(de));return le?(H.w=v.get(le[0].toLowerCase()),de+le[0].length):-1}function C(H,ie,de){var le=f.exec(ie.slice(de));return le?(H.w=h.get(le[0].toLowerCase()),de+le[0].length):-1}function I(H,ie,de){var le=x.exec(ie.slice(de));return le?(H.m=w.get(le[0].toLowerCase()),de+le[0].length):-1}function R(H,ie,de){var le=m.exec(ie.slice(de));return le?(H.m=b.get(le[0].toLowerCase()),de+le[0].length):-1}function F(H,ie,de){return P(H,t,ie,de)}function M(H,ie,de){return P(H,r,ie,de)}function Y(H,ie,de){return P(H,n,ie,de)}function X(H){return s[H.getDay()]}function $(H){return a[H.getDay()]}function ee(H){return c[H.getMonth()]}function V(H){return l[H.getMonth()]}function D(H){return o[+(H.getHours()>=12)]}function z(H){return 1+~~(H.getMonth()/3)}function q(H){return s[H.getUTCDay()]}function G(H){return a[H.getUTCDay()]}function U(H){return c[H.getUTCMonth()]}function Q(H){return l[H.getUTCMonth()]}function K(H){return o[+(H.getUTCHours()>=12)]}function re(H){return 1+~~(H.getUTCMonth()/3)}return{format:function(H){var ie=T(H+="",k);return ie.toString=function(){return H},ie},parse:function(H){var ie=A(H+="",!1);return ie.toString=function(){return H},ie},utcFormat:function(H){var ie=T(H+="",j);return ie.toString=function(){return H},ie},utcParse:function(H){var ie=A(H+="",!0);return ie.toString=function(){return H},ie}}}var EM={"-":"",_:" ",0:"0"},Do=/^\s*\d+/,ige=/^%/,oge=/[\\^$*+?|[\]().{}]/g;function un(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",a=o.length;return n+(a[t.toLowerCase(),r]))}function sge(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function lge(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function cge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function uge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function dge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function AM(e,t,r){var n=Do.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function TM(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 fge(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 pge(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 hge(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 PM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function gge(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 IM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function mge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function vge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function yge(e,t,r){var n=Do.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function xge(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 bge(e,t,r){var n=ige.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function wge(e,t,r){var n=Do.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Sge(e,t,r){var n=Do.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function OM(e,t){return un(e.getDate(),t,2)}function jge(e,t){return un(e.getHours(),t,2)}function kge(e,t){return un(e.getHours()%12||12,t,2)}function _ge(e,t){return un(1+Mb.count(xd(e),e),t,3)}function RV(e,t){return un(e.getMilliseconds(),t,3)}function Cge(e,t){return RV(e,t)+"000"}function Ege(e,t){return un(e.getMonth()+1,t,2)}function Age(e,t){return un(e.getMinutes(),t,2)}function Tge(e,t){return un(e.getSeconds(),t,2)}function Pge(e){var t=e.getDay();return t===0?7:t}function Ige(e,t){return un(IS.count(xd(e)-1,e),t,2)}function LV(e){var t=e.getDay();return t>=4||t===0?Wm(e):Wm.ceil(e)}function Oge(e,t){return e=LV(e),un(Wm.count(xd(e),e)+(xd(e).getDay()===4),t,2)}function Nge(e){return e.getDay()}function Rge(e,t){return un(M2.count(xd(e)-1,e),t,2)}function Lge(e,t){return un(e.getFullYear()%100,t,2)}function Fge(e,t){return e=LV(e),un(e.getFullYear()%100,t,2)}function zge(e,t){return un(e.getFullYear()%1e4,t,4)}function Mge(e,t){var r=e.getDay();return e=r>=4||r===0?Wm(e):Wm.ceil(e),un(e.getFullYear()%1e4,t,4)}function Dge(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+un(t/60|0,"0",2)+un(t%60,"0",2)}function NM(e,t){return un(e.getUTCDate(),t,2)}function Bge(e,t){return un(e.getUTCHours(),t,2)}function Wge(e,t){return un(e.getUTCHours()%12||12,t,2)}function qge(e,t){return un(1+PS.count(bd(e),e),t,3)}function FV(e,t){return un(e.getUTCMilliseconds(),t,3)}function $ge(e,t){return FV(e,t)+"000"}function Uge(e,t){return un(e.getUTCMonth()+1,t,2)}function Hge(e,t){return un(e.getUTCMinutes(),t,2)}function Vge(e,t){return un(e.getUTCSeconds(),t,2)}function Yge(e){var t=e.getUTCDay();return t===0?7:t}function Gge(e,t){return un(OS.count(bd(e)-1,e),t,2)}function zV(e){var t=e.getUTCDay();return t>=4||t===0?qm(e):qm.ceil(e)}function Kge(e,t){return e=zV(e),un(qm.count(bd(e),e)+(bd(e).getUTCDay()===4),t,2)}function Qge(e){return e.getUTCDay()}function Xge(e,t){return un(D2.count(bd(e)-1,e),t,2)}function Zge(e,t){return un(e.getUTCFullYear()%100,t,2)}function Jge(e,t){return e=zV(e),un(e.getUTCFullYear()%100,t,2)}function eme(e,t){return un(e.getUTCFullYear()%1e4,t,4)}function tme(e,t){var r=e.getUTCDay();return e=r>=4||r===0?qm(e):qm.ceil(e),un(e.getUTCFullYear()%1e4,t,4)}function rme(){return"+0000"}function RM(){return"%"}function LM(e){return+e}function FM(e){return Math.floor(+e/1e3)}var Dg,MV,DV;nme({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 nme(e){return Dg=nge(e),MV=Dg.format,Dg.parse,DV=Dg.utcFormat,Dg.utcParse,Dg}function ime(e){return new Date(e)}function ome(e){return e instanceof Date?+e:+new Date(+e)}function PP(e,t,r,n,o,a,s,l,c,u){var d=mP(),f=d.invert,h=d.domain,p=u(".%L"),v=u(":%S"),m=u("%I:%M"),b=u("%I %p"),x=u("%a %d"),w=u("%b %d"),k=u("%B"),j=u("%Y");function _(T){return(c(T)t(o/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(o,a)=>Gpe(e,a/n))},r.copy=function(){return $V(t).domain(e)},Id.apply(r,arguments)}function RS(){var e=0,t=.5,r=1,n=1,o,a,s,l,c,u=Ha,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-a)*(n*mr}return y4=e,y4}var x4,BM;function ume(){if(BM)return x4;BM=1;var e=LS(),t=YV(),r=Tv();function n(o){return o&&o.length?e(o,r,t):void 0}return x4=n,x4}var dme=ume();const FS=dn(dme);var b4,WM;function GV(){if(WM)return b4;WM=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};Jt.decimalPlaces=Jt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*oi;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Jt.dividedBy=Jt.div=function(e){return hd(this,new this.constructor(e))};Jt.dividedToIntegerBy=Jt.idiv=function(e){var t=this,r=t.constructor;return Wn(hd(t,new r(e),0,1),r.precision)};Jt.equals=Jt.eq=function(e){return!this.cmp(e)};Jt.exponent=function(){return no(this)};Jt.greaterThan=Jt.gt=function(e){return this.cmp(e)>0};Jt.greaterThanOrEqualTo=Jt.gte=function(e){return this.cmp(e)>=0};Jt.isInteger=Jt.isint=function(){return this.e>this.d.length-2};Jt.isNegative=Jt.isneg=function(){return this.s<0};Jt.isPositive=Jt.ispos=function(){return this.s>0};Jt.isZero=function(){return this.s===0};Jt.lessThan=Jt.lt=function(e){return this.cmp(e)<0};Jt.lessThanOrEqualTo=Jt.lte=function(e){return this.cmp(e)<1};Jt.logarithm=Jt.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(Hs))throw Error(Rl+"NaN");if(r.s<1)throw Error(Rl+(r.s?"NaN":"-Infinity"));return r.eq(Hs)?new n(0):(fi=!1,t=hd(Wx(r,a),Wx(e,a),a),fi=!0,Wn(t,o))};Jt.minus=Jt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JV(t,e):XV(t,(e.s=-e.s,e))};Jt.modulo=Jt.mod=function(e){var t,r=this,n=r.constructor,o=n.precision;if(e=new n(e),!e.s)throw Error(Rl+"NaN");return r.s?(fi=!1,t=hd(r,e,0,1).times(e),fi=!0,r.minus(t)):Wn(new n(r),o)};Jt.naturalExponential=Jt.exp=function(){return ZV(this)};Jt.naturalLogarithm=Jt.ln=function(){return Wx(this)};Jt.negated=Jt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Jt.plus=Jt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?XV(t,e):JV(t,(e.s=-e.s,e))};Jt.precision=Jt.sd=function(e){var t,r,n,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vh+e);if(t=no(o)+1,n=o.d.length-1,r=n*oi+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};Jt.squareRoot=Jt.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(Rl+"NaN")}for(e=no(l),fi=!1,o=Math.sqrt(+l),o==0||o==1/0?(t=Jc(l.d),(t.length+e)%2==0&&(t+="0"),o=Math.sqrt(t),e=Ov((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(hd(l,a,s+2)).times(.5),Jc(a.d).slice(0,s)===(t=Jc(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),o==s&&t=="4999"){if(Wn(a,r+1,0),a.times(a).eq(l)){n=a;break}}else if(t!="9999")break;s+=4}return fi=!0,Wn(n,r)};Jt.times=Jt.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%Oo|0,t=l/Oo|0;a[o]=(a[o]+t)%Oo|0}for(;!a[--s];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,fi?Wn(e,f.precision):e};Jt.toDecimalPlaces=Jt.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(su(e,0,Iv),t===void 0?t=n.rounding:su(t,0,8),Wn(r,e+no(r)+1,t))};Jt.toExponential=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=Th(n,!0):(su(e,0,Iv),t===void 0?t=o.rounding:su(t,0,8),n=Wn(new o(n),e+1,t),r=Th(n,!0,e+1)),r};Jt.toFixed=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?Th(o):(su(e,0,Iv),t===void 0?t=a.rounding:su(t,0,8),n=Wn(new a(o),e+no(o)+1,t),r=Th(n.abs(),!1,e+no(n)+1),o.isneg()&&!o.isZero()?"-"+r:r)};Jt.toInteger=Jt.toint=function(){var e=this,t=e.constructor;return Wn(new t(e),no(e)+1,t.rounding)};Jt.toNumber=function(){return+this};Jt.toPower=Jt.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(Hs);if(l=new c(l),!l.s){if(e.s<1)throw Error(Rl+"Infinity");return l}if(l.eq(Hs))return l;if(n=c.precision,e.eq(Hs))return Wn(l,n);if(t=e.e,r=e.d.length-1,s=t>=r,a=l.s,s){if((r=d<0?-d:d)<=QV){for(o=new c(Hs),t=Math.ceil(n/oi+4),fi=!1;r%2&&(o=o.times(l),YM(o.d,t)),r=Ov(r/2),r!==0;)l=l.times(l),YM(l.d,t);return fi=!0,e.s<0?new c(Hs).div(o):Wn(o,n)}}else if(a<0)throw Error(Rl+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,fi=!1,o=e.times(Wx(l,n+u)),fi=!0,o=ZV(o),o.s=a,o};Jt.toPrecision=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?(r=no(o),n=Th(o,r<=a.toExpNeg||r>=a.toExpPos)):(su(e,1,Iv),t===void 0?t=a.rounding:su(t,0,8),o=Wn(new a(o),e,t),r=no(o),n=Th(o,e<=r||r<=a.toExpNeg,e)),n};Jt.toSignificantDigits=Jt.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(su(e,1,Iv),t===void 0?t=n.rounding:su(t,0,8)),Wn(new n(r),e,t)};Jt.toString=Jt.valueOf=Jt.val=Jt.toJSON=Jt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=no(e),r=e.constructor;return Th(e,t<=r.toExpNeg||t>=r.toExpPos)};function XV(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)),fi?Wn(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/oi),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)/Oo|0,c[a]%=Oo;for(r&&(c.unshift(r),++o),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=o,fi?Wn(t,f):t}function su(e,t,r){if(e!==~~e||er)throw Error(vh+e)}function Jc(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,v,m,b,x,w,k,j,_,T,A,P,N=n.constructor,O=n.s==o.s?1:-1,C=n.d,I=o.d;if(!n.s)return new N(n);if(!o.s)throw Error(Rl+"Division by zero");for(c=n.e-o.e,A=I.length,_=C.length,p=new N(O),v=p.d=[],u=0;I[u]==(C[u]||0);)++u;if(I[u]>(C[u]||0)&&--c,a==null?w=a=N.precision:s?w=a+(no(n)-no(o))+1:w=a,w<0)return new N(0);if(w=w/oi+2|0,u=0,A==1)for(d=0,I=I[0],w++;(u<_||d)&&w--;u++)k=d*Oo+(C[u]||0),v[u]=k/I|0,d=k%I|0;else{for(d=Oo/(I[0]+1)|0,d>1&&(I=e(I,d),C=e(C,d),A=I.length,_=C.length),j=A,m=C.slice(0,A),b=m.length;b=Oo/2&&++T;do d=0,l=t(I,m,A,b),l<0?(x=m[0],A!=b&&(x=x*Oo+(m[1]||0)),d=x/T|0,d>1?(d>=Oo&&(d=Oo-1),f=e(I,d),h=f.length,b=m.length,l=t(f,m,h,b),l==1&&(d--,r(f,A16)throw Error(NP+no(e));if(!e.s)return new d(Hs);for(fi=!1,l=f,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(Xp(2,u))/Math.LN10*2+5|0,l+=n,r=o=a=new d(Hs),d.precision=l;;){if(o=Wn(o.times(e),l),r=r.times(++c),s=a.plus(hd(o,r,l)),Jc(s.d).slice(0,l)===Jc(a.d).slice(0,l)){for(;u--;)a=Wn(a.times(a),l);return d.precision=f,t==null?(fi=!0,Wn(a,f)):a}a=s}}function no(e){for(var t=e.e*oi,r=e.d[0];r>=10;r/=10)t++;return t}function _4(e,t,r){if(t>e.LN10.sd())throw fi=!0,r&&(e.precision=r),Error(Rl+"LN10 precision limit exceeded");return Wn(new e(e.LN10),t)}function _f(e){for(var t="";e--;)t+="0";return t}function Wx(e,t){var r,n,o,a,s,l,c,u,d,f=1,h=10,p=e,v=p.d,m=p.constructor,b=m.precision;if(p.s<1)throw Error(Rl+(p.s?"NaN":"-Infinity"));if(p.eq(Hs))return new m(0);if(t==null?(fi=!1,u=b):u=t,p.eq(10))return t==null&&(fi=!0),_4(m,u);if(u+=h,m.precision=u,r=Jc(v),n=r.charAt(0),a=no(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Jc(p.d),n=r.charAt(0),f++;a=no(p),n>1?(p=new m("0."+r),a++):p=new m(n+"."+r.slice(1))}else return c=_4(m,u+2,b).times(a+""),p=Wx(new m(n+"."+r.slice(1)),u-h).plus(c),m.precision=b,t==null?(fi=!0,Wn(p,b)):p;for(l=s=p=hd(p.minus(Hs),p.plus(Hs),u),d=Wn(p.times(p),u),o=3;;){if(s=Wn(s.times(d),u),c=l.plus(hd(s,new m(o),u)),Jc(c.d).slice(0,u)===Jc(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(_4(m,u+2,b).times(a+""))),l=hd(l,new m(f),u),m.precision=b,t==null?(fi=!0,Wn(l,b)):l;l=c,o+=2}}function VM(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=Ov(r/oi),e.d=[],n=(r+1)%oi,r<0&&(n+=oi),nB2||e.e<-B2))throw Error(NP+r)}else e.s=0,e.e=0,e.d=[0];return e}function Wn(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+=oi,o=t,u=f[d=0];else{if(d=Math.ceil((n+1)/oi),a=f.length,d>=a)return e;for(u=a=f[d],s=1;a>=10;a/=10)s++;n%=oi,o=n-oi+s}if(r!==void 0&&(a=Xp(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/Xp(10,s-o):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(a=no(e),f.length=1,t=t-a-1,f[0]=Xp(10,(oi-t%oi)%oi),e.e=Ov(-t/oi)||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=Xp(10,oi-n),f[d]=o>0?(u/Xp(10,s-o)%Xp(10,o)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==Oo&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Oo)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(fi&&(e.e>B2||e.e<-B2))throw Error(NP+no(e));return e}function JV(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),fi?Wn(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/oi),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)+_f(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+_f(-o-1)+a,r&&(n=r-s)>0&&(a+=_f(n))):o>=s?(a+=_f(o+1-s),r&&(n=r-o-1)>0&&(a=a+"."+_f(n))):((n=o+1)0&&(o+1===s&&(a+="."),a+=_f(n))),e.s<0?"-"+a:a}function YM(e,t){if(e.length>t)return e.length=t,!0}function eY(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(vh+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 VM(s,a.toString())}else if(typeof a!="string")throw Error(vh+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,bme.test(a))VM(s,a);else throw Error(vh+a)}if(o.prototype=Jt,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=eY,o.config=o.set=wme,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(vh+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(vh+r+": "+n);return this}var RP=eY(xme);Hs=new RP(1);const Ln=RP;function Sme(e){return Cme(e)||_me(e)||kme(e)||jme()}function jme(){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 kme(e,t){if(e){if(typeof e=="string")return yA(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 yA(e,t)}}function _me(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Cme(e){if(Array.isArray(e))return yA(e)}function yA(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,GM(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 Wme(e){if(Array.isArray(e))return e}function oY(e){var t=qx(e,2),r=t[0],n=t[1],o=r,a=n;return r>n&&(o=n,a=r),[o,a]}function aY(e,t,r){if(e.lte(0))return new Ln(0);var n=DS.getDigitCount(e.toNumber()),o=new Ln(10).pow(n),a=e.div(o),s=n!==1?.05:.1,l=new Ln(Math.ceil(a.div(s).toNumber())).add(r).mul(s),c=l.mul(o);return t?c:new Ln(Math.ceil(c))}function qme(e,t,r){var n=1,o=new Ln(e);if(!o.isint()&&r){var a=Math.abs(e);a<1?(n=new Ln(10).pow(DS.getDigitCount(e)-1),o=new Ln(Math.floor(o.div(n).toNumber())).mul(n)):a>1&&(o=new Ln(Math.floor(e)))}else e===0?o=new Ln(Math.floor((t-1)/2)):r||(o=new Ln(Math.floor(e)));var s=Math.floor((t-1)/2),l=Pme(Tme(function(c){return o.add(new Ln(c-s).mul(n)).toNumber()}),xA);return l(0,t)}function sY(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 Ln(0),tickMin:new Ln(0),tickMax:new Ln(0)};var a=aY(new Ln(t).sub(e).div(r-1),n,o),s;e<=0&&t>=0?s=new Ln(0):(s=new Ln(e).add(t).div(2),s=s.sub(new Ln(s).mod(a)));var l=Math.ceil(s.sub(e).div(a).toNumber()),c=Math.ceil(new Ln(t).sub(s).div(a).toNumber()),u=l+c+1;return u>r?sY(e,t,r,n,o+1):(u0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:a,tickMin:s.sub(new Ln(l).mul(a)),tickMax:s.add(new Ln(c).mul(a))})}function $me(e){var t=qx(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=oY([r,n]),c=qx(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(wA(xA(0,o-1).map(function(){return 1/0}))):[].concat(wA(xA(0,o-1).map(function(){return-1/0})),[d]);return r>n?bA(f):f}if(u===d)return qme(u,o,a);var h=sY(u,d,s,a),p=h.step,v=h.tickMin,m=h.tickMax,b=DS.rangeStep(v,m.add(new Ln(.1).mul(p)),p);return r>n?bA(b):b}function Ume(e,t){var r=qx(e,2),n=r[0],o=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=oY([n,o]),l=qx(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=aY(new Ln(u).sub(c).div(d-1),a,0),h=[].concat(wA(DS.rangeStep(new Ln(c),new Ln(u).sub(new Ln(.99).mul(f)),f)),[u]);return n>o?bA(h):h}var Hme=nY($me),Vme=nY(Ume),Yme="Invariant failed";function Ph(e,t){throw new Error(Yme)}var Gme=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function $m(e){"@babel/helpers - typeof";return $m=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},$m(e)}function W2(){return W2=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 tve(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 rve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nve(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($a(f-d)!==$a(h-f)){var v=[];if($a(h-f)===$a(c[1]-c[0])){p=h;var m=f+c[1]-c[0];v[0]=Math.min(m,(m+d)/2),v[1]=Math.max(m,(m+d)/2)}else{p=d;var b=h+c[1]-c[0];v[0]=Math.min(f,(b+f)/2),v[1]=Math.max(f,(b+f)/2)}var x=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>x[0]&&t<=x[1]||t>=v[0]&&t<=v[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 j=0;j0&&j(n[j].coordinate+n[j-1].coordinate)/2&&t<=(n[j].coordinate+n[j+1].coordinate)/2||j===l-1&&t>(n[j].coordinate+n[j-1].coordinate)/2){s=n[j].index;break}return s},LP=function(t){var r,n=t,o=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Oi(Oi({},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},bve=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(x&&x.length){var w=x[0].type.defaultProps,k=w!==void 0?Oi(Oi({},w),x[0].props):x[0].props,j=k.barSize,_=k[b];s[_]||(s[_]=[]);var T=Rr(j)?r:j;s[_].push({item:x[0],stackList:x.slice(1),barSize:Rr(T)?void 0:Ua(T,n,0)})}}return s},wve=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=Ua(r,o,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=o/c,v=s.reduce(function(j,_){return j+_.barSize||0},0);v+=(c-1)*u,v>=o&&(v-=(c-1)*u,u=0),v>=o&&p>0&&(h=!0,p*=.9,v=c*p);var m=(o-v)/2>>0,b={offset:m-u,size:0};d=s.reduce(function(j,_){var T={item:_.item,position:{offset:b.offset+b.size+u,size:h?p:_.barSize}},A=[].concat(XM(j),[T]);return b=A[A.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(P){A.push({item:P,position:b})}),A},f)}else{var x=Ua(n,o,0,!0);o-2*x-(c-1)*u<=0&&(u=0);var w=(o-2*x-(c-1)*u)/c;w>1&&(w>>=0);var k=l===+l?Math.min(w,l):w;d=s.reduce(function(j,_,T){var A=[].concat(XM(j),[{item:_.item,position:{offset:x+(w+u)*T+(w-k)/2,size:k}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(P){A.push({item:P,position:A[A.length-1].position})}),A},f)}return d},Sve=function(t,r,n,o){var a=n.children,s=n.width,l=n.margin,c=s-(l.left||0)-(l.right||0),u=dY({children:a,legendWidth:c});if(u){var d=o||{},f=d.width,h=d.height,p=u.align,v=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&v==="middle")&&p!=="center"&&qt(t[p]))return Oi(Oi({},t),{},ym({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&v!=="middle"&&qt(t[v]))return Oi(Oi({},t),{},ym({},v,t[v]+(h||0)))}return t},jve=function(t,r,n){return Rr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},fY=function(t,r,n,o,a){var s=r.props.children,l=Ks(s,Bb).filter(function(u){return jve(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=po(d,n);if(Rr(f))return u;var h=Array.isArray(f)?[zS(f),FS(f)]:[f,f],p=c.reduce(function(v,m){var b=po(d,m,0),x=h[0]-Math.abs(Array.isArray(b)?b[0]:b),w=h[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(x,v[0]),Math.max(w,v[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},kve=function(t,r,n,o,a){var s=r.map(function(l){return fY(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},pY=function(t,r,n,o,a){var s=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&fY(t,c,u,o)||ox(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?$a(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!Nb(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}})},C4=new WeakMap,s1=function(t,r){if(typeof r!="function")return t;C4.has(t)||C4.set(t,new WeakMap);var n=C4.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},mY=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:Fx(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:F2(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:ix(),realScaleType:"point"}:a==="category"?{scale:Fx(),realScaleType:"band"}:{scale:F2(),realScaleType:"linear"};if(Ob(o)){var c="scale".concat(wS(o));return{scale:(zM[c]||ix)(),realScaleType:zM[c]?c:"point"}}return Ar(o)?{scale:o}:{scale:ix(),realScaleType:"point"}},JM=1e-4,vY=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])-JM,s=Math.max(o[0],o[1])+JM,l=t(r[0]),c=t(r[n-1]);(ls||cs)&&t.domain([r[0],r[n-1]])}},_ve=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])}},Ave=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)}},Tve={sign:Eve,expand:vue,none:Lm,silhouette:yue,wiggle:xue,positive:Ave},Pve=function(t,r,n){var o=r.map(function(l){return l.props.dataKey}),a=Tve[n],s=mue().keys(o).value(function(l,c){return+po(l,c,0)}).order(eA).offset(a);return s(t)},Ive=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,v=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Oi(Oi({},h.type.defaultProps),h.props):h.props,m=v.stackId,b=v.hide;if(b)return f;var x=v[n],w=f[x]||{hasStack:!1,stackGroups:{}};if(mo(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[Av("_stackId_")]={numericAxisId:n,cateAxisId:o,items:[h]};return Oi(Oi({},f),{},ym({},x,w))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var v={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,b){var x=p.stackGroups[b];return Oi(Oi({},m),{},ym({},b,{numericAxisId:n,cateAxisId:o,items:x.items,stackedData:Pve(t,x.items,a)}))},v)}return Oi(Oi({},f),{},ym({},h,p))},d)},yY=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=Hme(u,a,l);return t.domain([zS(d),FS(d)]),{niceTicks:d}}if(a&&o==="number"){var f=t.domain(),h=Vme(f,a,l);return{niceTicks:h}}return null};function eD(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=v2(r,"value",o[t.dataKey]);if(l)return l.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=po(o,Rr(s)?t.dataKey:s);return Rr(c)?null:t.scale(c)}var tD=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=po(s,r.dataKey,r.domain[l]);return Rr(c)?null:r.scale(c)-a/2+o},Ove=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]},Nve=function(t,r){var n,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Oi(Oi({},t.type.defaultProps),t.props):t.props,a=o.stackId;if(mo(a)){var s=r[a];if(s){var l=s.items.indexOf(t);return l>=0?s.stackedData[l]:null}}return null},Rve=function(t){return t.reduce(function(r,n){return[zS(n.concat([r[0]]).filter(qt)),FS(n.concat([r[1]]).filter(qt))]},[1/0,-1/0])},xY=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=Rve(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})},rD=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,nD=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_A=function(t,r,n){if(Ar(t))return t(r,n);if(!Array.isArray(t))return r;var o=[];if(qt(t[0]))o[0]=n?t[0]:Math.min(t[0],r[0]);else if(rD.test(t[0])){var a=+rD.exec(t[0])[1];o[0]=r[0]-a}else Ar(t[0])?o[0]=t[0](r[0]):o[0]=r[0];if(qt(t[1]))o[1]=n?t[1]:Math.max(t[1],r[1]);else if(nD.test(t[1])){var s=+nD.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},$2=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=cP(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},$ve=function(t,r,n,o,a){var s=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ua(t.cx,s,s/2),f=Ua(t.cy,l,l/2),h=SY(s,l,n),p=Ua(t.innerRadius,h,0),v=Ua(t.outerRadius,h,h*.8),m=Object.keys(r);return m.reduce(function(b,x){var w=r[x],k=w.domain,j=w.reversed,_;if(Rr(w.range))o==="angleAxis"?_=[c,u]:o==="radiusAxis"&&(_=[p,v]),j&&(_=[_[1],_[0]]);else{_=w.range;var T=_,A=zve(T,2);c=A[0],u=A[1]}var P=mY(w,a),N=P.realScaleType,O=P.scale;O.domain(k).range(_),vY(O);var C=yY(O,Ju(Ju({},w),{},{realScaleType:N})),I=Ju(Ju(Ju({},w),C),{},{range:_,radius:v,realScaleType:N,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:v,startAngle:c,endAngle:u});return Ju(Ju({},b),{},wY({},x,I))},{})},Uve=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))},Hve=function(t,r){var n=t.x,o=t.y,a=r.cx,s=r.cy,l=Uve({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:qve(u),angleInRadian:u}},Vve=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}},Yve=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},sD=function(t,r){var n=t.x,o=t.y,a=Hve({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=Vve(r),f=d.startAngle,h=d.endAngle,p=l,v;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 v?Ju(Ju({},r),{},{radius:s,angle:Yve(p,r)}):null},jY=function(t){return!S.isValidElement(t)&&!Ar(t)&&typeof t!="boolean"?t.className:""};function Vx(e){"@babel/helpers - typeof";return Vx=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},Vx(e)}var Gve=["offset"];function Kve(e){return Jve(e)||Zve(e)||Xve(e)||Qve()}function Qve(){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 Xve(e,t){if(e){if(typeof e=="string")return CA(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 CA(e,t)}}function Zve(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jve(e){if(Array.isArray(e))return CA(e)}function CA(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 tye(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 lD(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 uo(e){for(var t=1;t=0?1:-1,k,j;o==="insideStart"?(k=p+w*s,j=m):o==="insideEnd"?(k=v-w*s,j=!m):o==="end"&&(k=v+w*s,j=m),j=x<=0?j:!j;var _=Xn(u,d,b,k),T=Xn(u,d,b,k+(j?1:-1)*359),A="M".concat(_.x,",").concat(_.y,` - A`).concat(b,",").concat(b,",0,1,").concat(j?0:1,`, - `).concat(T.x,",").concat(T.y),P=Rr(t.id)?Av("recharts-radial-line-"):t.id;return $e.createElement("text",Yx({},n,{dominantBaseline:"central",className:Fr("recharts-radial-bar-label",l)}),$e.createElement("defs",null,$e.createElement("path",{id:P,d:A})),$e.createElement("textPath",{xlinkHref:"#".concat(P)},r))},lye=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=Xn(s,l,u+n,h),v=p.x,m=p.y;return{x:v,y:m,textAnchor:v>=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 b=(c+u)/2,x=Xn(s,l,b,h),w=x.x,k=x.y;return{x:w,y:k,textAnchor:"middle",verticalAnchor:"middle"}},cye=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",v=f>0?"start":"end",m=u>=0?1:-1,b=m*o,x=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 uo(uo({},k),n?{height:Math.max(c-n.y,0),width:u}:{})}if(a==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:v};return uo(uo({},j),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(a==="left"){var _={x:l-b,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return uo(uo({},_),n?{width:Math.max(_.x-n.x,0),height:d}:{})}if(a==="right"){var T={x:l+u+b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"};return uo(uo({},T),n?{width:Math.max(n.x+n.width-T.x,0),height:d}:{})}var A=n?{width:u,height:d}:{};return a==="insideLeft"?uo({x:l+b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"},A):a==="insideRight"?uo({x:l+u-b,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},A):a==="insideTop"?uo({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:v},A):a==="insideBottom"?uo({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},A):a==="insideTopLeft"?uo({x:l+b,y:c+h,textAnchor:w,verticalAnchor:v},A):a==="insideTopRight"?uo({x:l+u-b,y:c+h,textAnchor:x,verticalAnchor:v},A):a==="insideBottomLeft"?uo({x:l+b,y:c+d-h,textAnchor:w,verticalAnchor:p},A):a==="insideBottomRight"?uo({x:l+u-b,y:c+d-h,textAnchor:x,verticalAnchor:p},A):Ev(a)&&(qt(a.x)||lh(a.x))&&(qt(a.y)||lh(a.y))?uo({x:l+Ua(a.x,u),y:c+Ua(a.y,d),textAnchor:"end",verticalAnchor:"end"},A):uo({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},uye=function(t){return"cx"in t&&qt(t.cx)};function Fo(e){var t=e.offset,r=t===void 0?5:t,n=eye(e,Gve),o=uo({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)&&!S.isValidElement(u)&&!Ar(u))return null;if(S.isValidElement(u))return S.cloneElement(u,o);var p;if(Ar(u)){if(p=S.createElement(u,o),S.isValidElement(p))return p}else p=oye(o);var v=uye(a),m=yr(o,!0);if(v&&(s==="insideStart"||s==="insideEnd"||s==="end"))return sye(o,p,m);var b=v?lye(o):cye(o);return $e.createElement(Ah,Yx({className:Fr("recharts-label",f)},m,b,{breakAll:h}),p)}Fo.displayName="Label";var kY=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,v=t.left,m=t.width,b=t.height,x=t.clockWise,w=t.labelViewBox;if(w)return w;if(qt(m)&&qt(b)){if(qt(f)&&qt(h))return{x:f,y:h,width:m,height:b};if(qt(p)&&qt(v))return{x:p,y:v,width:m,height:b}}return qt(f)&&qt(h)?{x:f,y:h,width:0,height:0}:qt(r)&&qt(n)?{cx:r,cy:n,startAngle:a||o||0,endAngle:s||o||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},dye=function(t,r){return t?t===!0?$e.createElement(Fo,{key:"label-implicit",viewBox:r}):mo(t)?$e.createElement(Fo,{key:"label-implicit",viewBox:r,value:t}):S.isValidElement(t)?t.type===Fo?S.cloneElement(t,{key:"label-implicit",viewBox:r}):$e.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):Ar(t)?$e.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):Ev(t)?$e.createElement(Fo,Yx({viewBox:r},t,{key:"label-implicit"})):null:null},fye=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=kY(t),s=Ks(o,Fo).map(function(c,u){return S.cloneElement(c,{viewBox:r||a,key:"label-".concat(u)})});if(!n)return s;var l=dye(t.label,r||a);return[l].concat(Kve(s))};Fo.parseViewBox=kY;Fo.renderCallByParent=fye;var E4,cD;function pye(){if(cD)return E4;cD=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return E4=e,E4}var hye=pye();const gye=dn(hye);function Gx(e){"@babel/helpers - typeof";return Gx=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},Gx(e)}var mye=["valueAccessor"],vye=["data","dataKey","clockWise","id","textBreakAll"];function yye(e){return Sye(e)||wye(e)||bye(e)||xye()}function xye(){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 bye(e,t){if(e){if(typeof e=="string")return EA(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 EA(e,t)}}function wye(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sye(e){if(Array.isArray(e))return EA(e)}function EA(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 Cye(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 Eye=function(t){return Array.isArray(t.value)?gye(t.value):t.value};function gd(e){var t=e.valueAccessor,r=t===void 0?Eye:t,n=fD(e,mye),o=n.data,a=n.dataKey,s=n.clockWise,l=n.id,c=n.textBreakAll,u=fD(n,vye);return!o||!o.length?null:$e.createElement(cn,{className:"recharts-label-list"},o.map(function(d,f){var h=Rr(a)?r(d,f):po(d&&d.payload,a),p=Rr(l)?{}:{id:"".concat(l,"-").concat(f)};return $e.createElement(Fo,H2({},yr(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Fo.parseViewBox(Rr(s)?d:dD(dD({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}gd.displayName="LabelList";function Aye(e,t){return e?e===!0?$e.createElement(gd,{key:"labelList-implicit",data:t}):$e.isValidElement(e)||Ar(e)?$e.createElement(gd,{key:"labelList-implicit",data:t,content:e}):Ev(e)?$e.createElement(gd,H2({data:t},e,{key:"labelList-implicit"})):null:null}function Tye(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,gd).map(function(s,l){return S.cloneElement(s,{data:t,key:"labelList-".concat(l)})});if(!r)return o;var a=Aye(e.label,t);return[a].concat(yye(o))}gd.renderCallByParent=Tye;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)}function AA(){return AA=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=Xn(r,n,o,s),v=Xn(r,n,o,u);h+="L ".concat(v.x,",").concat(v.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},Rye=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=$a(d-u),h=l1({cx:r,cy:n,radius:a,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,v=h.lineTangency,m=h.theta,b=l1({cx:r,cy:n,radius:a,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),x=b.circleTangency,w=b.lineTangency,k=b.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-k;if(j<0)return l?"M ".concat(v.x,",").concat(v.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 - `):_Y({cx:r,cy:n,innerRadius:o,outerRadius:a,startAngle:u,endAngle:d});var _="M ".concat(v.x,",").concat(v.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(a,",").concat(a,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(x.x,",").concat(x.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(w.x,",").concat(w.y,` - `);if(o>0){var T=l1({cx:r,cy:n,radius:o,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),A=T.circleTangency,P=T.lineTangency,N=T.theta,O=l1({cx:r,cy:n,radius:o,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),C=O.circleTangency,I=O.lineTangency,R=O.theta,F=c?Math.abs(u-d):Math.abs(u-d)-N-R;if(F<0&&s===0)return"".concat(_,"L").concat(r,",").concat(n,"Z");_+="L".concat(I.x,",").concat(I.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(C.x,",").concat(C.y,` - A`).concat(o,",").concat(o,",0,").concat(+(F>180),",").concat(+(f>0),",").concat(A.x,",").concat(A.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,"Z")}else _+="L".concat(r,",").concat(n,"Z");return _},Lye={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},CY=function(t){var r=hD(hD({},Lye),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?b=Rye({cx:n,cy:o,innerRadius:a,outerRadius:s,cornerRadius:Math.min(m,v/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):b=_Y({cx:n,cy:o,innerRadius:a,outerRadius:s,startAngle:d,endAngle:f}),$e.createElement("path",AA({},yr(r,!0),{className:p,d:b,role:"img"}))};function Qx(e){"@babel/helpers - typeof";return Qx=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},Qx(e)}function TA(){return TA=Object.assign?Object.assign.bind():function(e){for(var t=1;tYye.call(e,t));function Qh(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Qye="__v",Xye="__o",Zye="_owner",{getOwnPropertyDescriptor:SD,keys:jD}=Object;function Jye(e,t){return e.byteLength===t.byteLength&&Y2(new Uint8Array(e),new Uint8Array(t))}function exe(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 txe(e,t){return e.byteLength===t.byteLength&&Y2(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function rxe(e,t){return Qh(e.getTime(),t.getTime())}function nxe(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function ixe(e,t){return e===t}function kD(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 oxe=Qh;function axe(e,t,r){const n=jD(e);let o=n.length;if(jD(t).length!==o)return!1;for(;o-- >0;)if(!EY(e,t,r,n[o]))return!1;return!0}function Ay(e,t,r){const n=wD(e);let o=n.length;if(wD(t).length!==o)return!1;let a,s,l;for(;o-- >0;)if(a=n[o],!EY(e,t,r,a)||(s=SD(e,a),l=SD(t,a),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function sxe(e,t){return Qh(e.valueOf(),t.valueOf())}function lxe(e,t){return e.source===t.source&&e.flags===t.flags}function _D(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 Y2(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 cxe(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 EY(e,t,r,n){return(n===Zye||n===Xye||n===Qye)&&(e.$$typeof||t.$$typeof)?!0:Kye(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const uxe="[object ArrayBuffer]",dxe="[object Arguments]",fxe="[object Boolean]",pxe="[object DataView]",hxe="[object Date]",gxe="[object Error]",mxe="[object Map]",vxe="[object Number]",yxe="[object Object]",xxe="[object RegExp]",bxe="[object Set]",wxe="[object String]",Sxe={"[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},jxe="[object URL]",kxe=Object.prototype.toString;function _xe({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:v}){return function(b,x,w){if(b===x)return!0;if(b==null||x==null)return!1;const k=typeof b;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(b,x,w):k==="function"?a(b,x,w):!1;const j=b.constructor;if(j!==x.constructor)return!1;if(j===Object)return c(b,x,w);if(Array.isArray(b))return t(b,x,w);if(j===Date)return n(b,x,w);if(j===RegExp)return d(b,x,w);if(j===Map)return s(b,x,w);if(j===Set)return f(b,x,w);const _=kxe.call(b);if(_===hxe)return n(b,x,w);if(_===xxe)return d(b,x,w);if(_===mxe)return s(b,x,w);if(_===bxe)return f(b,x,w);if(_===yxe)return typeof b.then!="function"&&typeof x.then!="function"&&c(b,x,w);if(_===jxe)return p(b,x,w);if(_===gxe)return o(b,x,w);if(_===dxe)return c(b,x,w);if(Sxe[_])return h(b,x,w);if(_===uxe)return e(b,x,w);if(_===pxe)return r(b,x,w);if(_===fxe||_===vxe||_===wxe)return u(b,x,w);if(v){let T=v[_];if(!T){const A=Gye(b);A&&(T=v[A])}if(T)return T(b,x,w)}return!1}}function Cxe({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:Jye,areArraysEqual:r?Ay:exe,areDataViewsEqual:txe,areDatesEqual:rxe,areErrorsEqual:nxe,areFunctionsEqual:ixe,areMapsEqual:r?I4(kD,Ay):kD,areNumbersEqual:oxe,areObjectsEqual:r?Ay:axe,arePrimitiveWrappersEqual:sxe,areRegExpsEqual:lxe,areSetsEqual:r?I4(_D,Ay):_D,areTypedArraysEqual:r?I4(Y2,Ay):Y2,areUrlsEqual:cxe,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const o=u1(n.areArraysEqual),a=u1(n.areMapsEqual),s=u1(n.areObjectsEqual),l=u1(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:s,areSetsEqual:l})}return n}function Exe(e){return function(t,r,n,o,a,s,l){return e(t,r,l)}}function Axe({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 Txe=rp();rp({strict:!0});rp({circular:!0});rp({circular:!0,strict:!0});rp({createInternalComparator:()=>Qh});rp({strict:!0,createInternalComparator:()=>Qh});rp({circular:!0,createInternalComparator:()=>Qh});rp({circular:!0,createInternalComparator:()=>Qh,strict:!0});function rp(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=Cxe(e),s=_xe(a),l=r?r(s):Exe(s);return Axe({circular:t,comparator:s,createState:n,equals:l,strict:o})}function Pxe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function CD(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):Pxe(o)};requestAnimationFrame(n)}function PA(e){"@babel/helpers - typeof";return PA=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},PA(e)}function Ixe(e){return Lxe(e)||Rxe(e)||Nxe(e)||Oxe()}function Oxe(){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 Nxe(e,t){if(e){if(typeof e=="string")return ED(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 ED(e,t)}}function ED(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:x<0?0:x},m=function(x){for(var w=x>1?1:x,k=w,j=0;j<8;++j){var _=f(k)-w,T=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,v=h*a,m=h+(p-v)*l/1e3,b=h*l/1e3+d;return Math.abs(b-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 fbe(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 O4(e){return mbe(e)||gbe(e)||hbe(e)||pbe()}function pbe(){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 hbe(e,t){if(e){if(typeof e=="string")return LA(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 LA(e,t)}}function gbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mbe(e){if(Array.isArray(e))return LA(e)}function LA(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 Q2(e){return Q2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Q2(e)}var lu=(function(e){wbe(r,e);var t=Sbe(r);function r(n,o){var a;vbe(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(MA(a)),a.changeStyle=a.changeStyle.bind(MA(a)),!l||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),zA(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},zA(a);a.state={style:c?Zy({},c,u):u}}else a.state={style:{}};return a}return xbe(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?Zy({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(Txe(o.to,d)&&o.canBegin&&o.isActive)){var v=!o.canBegin||!o.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=v||u?f:o.to;if(this.state&&h){var b={style:c?Zy({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(b)}this.runAnimation(Jl(Jl({},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=cbe(s,l,Zxe(u),c,this.changeStyle),v=function(){a.stopJSAnimation=p()};this.manager.start([h,d,v,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,b,x){if(x===0)return m;var w=b.duration,k=b.easing,j=k===void 0?"ease":k,_=b.style,T=b.properties,A=b.onAnimationEnd,P=x>0?s[x-1]:b,N=T||Object.keys(_);if(typeof j=="function"||j==="spring")return[].concat(O4(m),[a.runJSAnimation.bind(a,{from:P.style,to:_,duration:w,easing:j}),w]);var O=PD(N,w,j),C=Jl(Jl(Jl({},P.style),_),{},{transition:O});return[].concat(O4(m),[C,w,A]).filter(Bxe)};return this.manager.start([c].concat(O4(s.reduce(p,[d,Math.max(h,l)])),[o.onAnimationEnd]))}},{key:"runAnimation",value:function(o){this.manager||(this.manager=Fxe());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,v=this.manager;if(this.unSubscribe=v.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?Zy({},l,c):c,b=PD(Object.keys(m),s,u);v.start([d,a,Jl(Jl({},m),{},{transition:b}),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=dbe(o,ube),u=S.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 v=p.props,m=v.style,b=m===void 0?{}:m,x=v.className,w=S.cloneElement(p,Jl(Jl({},c),{},{style:Jl(Jl({},b),d),className:x}));return w};return u===1?f(S.Children.only(a)):$e.createElement("div",null,S.Children.map(a,function(h){return f(h)}))}}]),r})(S.PureComponent);lu.displayName="Animate";lu.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};lu.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 Jx(e){"@babel/helpers - typeof";return Jx=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},Jx(e)}function X2(){return X2=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 v=Math.min(s,a);d="M ".concat(t,",").concat(r+l*v,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+c*v,",").concat(r,` - L `).concat(t+n-c*v,",").concat(r,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*v,` - L `).concat(t+n,",").concat(r+o-l*v,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n-c*v,",").concat(r+o,` - L `).concat(t+c*v,",").concat(r+o,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t,",").concat(r+o-l*v," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(o," h ").concat(-n," Z");return d},Obe=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},Nbe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FP=function(t){var r=MD(MD({},Nbe),t),n=S.useRef(),o=S.useState(-1),a=kbe(o,2),s=a[0],l=a[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var j=n.current.getTotalLength();j&&l(j)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,h=r.radius,p=r.className,v=r.animationEasing,m=r.animationDuration,b=r.animationBegin,x=r.isAnimationActive,w=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var k=Fr("recharts-rectangle",p);return w?$e.createElement(lu,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:v,isActive:w},function(j){var _=j.width,T=j.height,A=j.x,P=j.y;return $e.createElement(lu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:m,isActive:x,easing:v},$e.createElement("path",X2({},yr(r,!0),{className:k,d:DD(A,P,_,T,h),ref:n})))}):$e.createElement("path",X2({},yr(r,!0),{className:k,d:DD(c,u,d,f,h)}))},Rbe=["points","className","baseLinePoints","connectNulls"];function nm(){return nm=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 Fbe(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 BD(e){return Bbe(e)||Dbe(e)||Mbe(e)||zbe()}function zbe(){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 Mbe(e,t){if(e){if(typeof e=="string")return DA(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 DA(e,t)}}function Dbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bbe(e){if(Array.isArray(e))return DA(e)}function DA(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){WD(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),WD(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},sx=function(t,r){var n=Wbe(t);r&&(n=[n.reduce(function(a,s){return[].concat(BD(a),BD(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},qbe=function(t,r,n){var o=sx(t,n);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(sx(r.reverse(),n).slice(1))},$be=function(t){var r=t.points,n=t.className,o=t.baseLinePoints,a=t.connectNulls,s=Lbe(t,Rbe);if(!r||!r.length)return null;var l=Fr("recharts-polygon",n);if(o&&o.length){var c=s.stroke&&s.stroke!=="none",u=qbe(r,o,a);return $e.createElement("g",{className:l},$e.createElement("path",nm({},yr(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?$e.createElement("path",nm({},yr(s,!0),{fill:"none",d:sx(r,a)})):null,c?$e.createElement("path",nm({},yr(s,!0),{fill:"none",d:sx(o,a)})):null)}var d=sx(r,a);return $e.createElement("path",nm({},yr(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function BA(){return BA=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 Qbe(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 Xbe=function(t,r,n,o,a,s){return"M".concat(t,",").concat(a,"v").concat(o,"M").concat(s,",").concat(r,"h").concat(n)},Zbe=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,v=t.className,m=Kbe(t,Ube),b=Hbe({x:n,y:a,top:l,left:u,width:f,height:p},m);return!qt(n)||!qt(a)||!qt(f)||!qt(p)||!qt(l)||!qt(u)?null:$e.createElement("path",WA({},yr(b,!0),{className:Fr("recharts-cross",v),d:Xbe(n,a,f,p,l,u)}))},N4,$D;function Jbe(){if($D)return N4;$D=1;var e=LS(),t=YV(),r=fu();function n(o,a){return o&&o.length?e(o,r(a,2),t):void 0}return N4=n,N4}var e0e=Jbe();const t0e=dn(e0e);var R4,UD;function r0e(){if(UD)return R4;UD=1;var e=LS(),t=fu(),r=GV();function n(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return R4=n,R4}var n0e=r0e();const i0e=dn(n0e);var o0e=["cx","cy","angle","ticks","axisLine"],a0e=["ticks","tick","angle","tickFormatter","stroke"];function Hm(e){"@babel/helpers - typeof";return Hm=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},Hm(e)}function lx(){return lx=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 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}function l0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YD(e,t){for(var r=0;rQD?s=o==="outer"?"start":"end":a<-QD?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=Fp(Fp({},yr(this.props,!1)),{},{fill:"none"},yr(l,!1));if(c==="circle")return $e.createElement(BS,oh({className:"recharts-polar-angle-axis-line"},u,{cx:o,cy:a,r:s}));var d=this.props.ticks,f=d.map(function(h){return Xn(o,a,s,h.coordinate)});return $e.createElement($be,oh({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=yr(this.props,!1),f=yr(s,!1),h=Fp(Fp({},d),{},{fill:"none"},yr(l,!1)),p=a.map(function(v,m){var b=n.getTickLineCoord(v),x=n.getTickTextAnchor(v),w=Fp(Fp(Fp({textAnchor:x},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:v,x:b.x2,y:b.y2});return $e.createElement(cn,oh({className:Fr("recharts-polar-angle-axis-tick",jY(s)),key:"tick-".concat(v.coordinate)},Eh(n.props,v,m)),l&&$e.createElement("line",oh({className:"recharts-polar-angle-axis-tick-line"},h,b)),s&&t.renderTickItem(s,w,c?c(v.value,m):v.value))});return $e.createElement(cn,{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:$e.createElement(cn,{className:Fr("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,o,a){var s;return $e.isValidElement(n)?s=$e.cloneElement(n,o):Ar(n)?s=n(o):s=$e.createElement(Ah,oh({},o,{className:"recharts-polar-angle-axis-tick-value"}),a),s}}])})(S.PureComponent);$S(US,"displayName","PolarAngleAxis");$S(US,"axisType","angleAxis");$S(US,"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 L4,XD;function j0e(){if(XD)return L4;XD=1;var e=YH(),t=e(Object.getPrototypeOf,Object);return L4=t,L4}var F4,ZD;function k0e(){if(ZD)return F4;ZD=1;var e=Td(),t=j0e(),r=Pd(),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 F4=u,F4}var _0e=k0e();const C0e=dn(_0e);var z4,JD;function E0e(){if(JD)return z4;JD=1;var e=Td(),t=Pd(),r="[object Boolean]";function n(o){return o===!0||o===!1||t(o)&&e(o)==r}return z4=n,z4}var A0e=E0e();const T0e=dn(A0e);function tb(e){"@babel/helpers - typeof";return tb=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},tb(e)}function ew(){return ew=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:v,isActive:x},function(k){var j=k.upperWidth,_=k.lowerWidth,T=k.height,A=k.x,P=k.y;return $e.createElement(lu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:m,easing:v},$e.createElement("path",ew({},yr(r,!0),{className:w,d:n7(A,P,j,_,T),ref:n})))}):$e.createElement("g",null,$e.createElement("path",ew({},yr(r,!0),{className:w,d:n7(c,u,d,f,h)})))},B0e=["option","shapeType","propTransformer","activeClassName","isActive"];function rb(e){"@babel/helpers - typeof";return rb=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},rb(e)}function W0e(e,t){if(e==null)return{};var r=q0e(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 q0e(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 i7(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 tw(e){for(var t=1;t0?Gs(k,"paddingAngle",0):0;if(_){var A=$s(_.endAngle-_.startAngle,k.endAngle-k.startAngle),P=Yn(Yn({},k),{},{startAngle:w+T,endAngle:w+A(m)+T});b.push(P),w=P.endAngle}else{var N=k.endAngle,O=k.startAngle,C=$s(0,N-O),I=C(m),R=Yn(Yn({},k),{},{startAngle:w+T,endAngle:w+I+T});b.push(R),w=R.endAngle}}),$e.createElement(cn,null,n.renderSectorsStatically(b))})}},{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||!Db(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,v=this.state.isAnimationFinished;if(a||!s||!s.length||!qt(u)||!qt(d)||!qt(f)||!qt(h))return null;var m=Fr("recharts-pie",l);return $e.createElement(cn,{tabIndex:this.props.rootTabIndex,className:m,ref:function(x){n.pieRef=x}},this.renderSectors(),c&&this.renderLabels(s),Fo.renderCallByParent(this.props,null,!1),(!p||v)&&gd.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,j=b-w*p-k,_=o.reduce(function(P,N){var O=po(N,x,0);return P+(qt(O)?O:0)},0),T;if(_>0){var A;T=o.map(function(P,N){var O=po(P,x,0),C=po(P,d,N),I=(qt(O)?O:0)/_,R;N?R=A.endAngle+$a(m)*c*(O!==0?1:0):R=s;var F=R+$a(m)*((O!==0?p:0)+I*j),M=(R+F)/2,Y=(v.innerRadius+v.outerRadius)/2,X=[{name:C,value:O,payload:P,dataKey:x,type:h}],$=Xn(v.cx,v.cy,Y,M);return A=Yn(Yn(Yn({percent:I,cornerRadius:a,name:C,tooltipPayload:X,midAngle:M,middleRadius:Y,tooltipPosition:$},P),v),{},{value:po(P,x),startAngle:R,endAngle:F,payload:P,paddingAngle:$a(m)*c}),A})}return Yn(Yn({},v),{},{sectors:T,data:o})});var M4,l7;function c1e(){if(l7)return M4;l7=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 M4=r,M4}var D4,c7;function WY(){if(c7)return D4;c7=1;var e=cV(),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 D4=n,D4}var B4,u7;function u1e(){if(u7)return B4;u7=1;var e=c1e(),t=ES(),r=WY();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])}),Ws(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()}),Ws(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Ws(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Ws(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Ws(n,"handleSlideDragStart",function(o){var a=m7(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 S1e(t,e),y1e(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),v=t.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:v===d?d:v-v%c}}},{key:"getTextOfTick",value:function(n){var o=this.props,a=o.data,s=o.tickFormatter,l=o.dataKey,c=po(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,v=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 b=this.getIndex({startX:s+m,endX:l+m});(b.startIndex!==h||b.endIndex!==p)&&v&&v(b),this.setState({startX:s+m,endX:l+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,o){var a=m7(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,v=d.onChange,m=d.gap,b=d.data,x={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)),x[s]=u+w;var k=this.getIndex(x),j=k.startIndex,_=k.endIndex,T=function(){var P=b.length-1;return s==="startX"&&(l>c?j%m===0:_%m===0)||lc?_%m===0:j%m===0)||l>c&&_===P};this.setState(Ws(Ws({},s,u+w),"brushMoveStartX",n.pageX),function(){v&&T()&&v(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(Ws({},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 $e.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=S.Children.only(u);return f?$e.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,v=c.data,m=c.startIndex,b=c.endIndex,x=Math.max(n,this.props.x),w=q4(q4({},yr(this.props,!1)),{},{x,y:u,width:d,height:f}),k=p||"Min value: ".concat((a=v[m])===null||a===void 0?void 0:a.name,", Max value: ").concat((s=v[b])===null||s===void 0?void 0:s.name);return $e.createElement(cn,{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 $e.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,v={pointerEvents:"none",fill:u};return $e.createElement(cn,{className:"recharts-brush-texts"},$e.createElement(Ah,iw({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+l/2},v),this.getTextOfTick(o)),$e.createElement(Ah,iw({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+l/2},v),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,v=h.endX,m=h.isTextActive,b=h.isSlideMoving,x=h.isTravellerMoving,w=h.isTravellerFocused;if(!o||!o.length||!qt(l)||!qt(c)||!qt(u)||!qt(d)||u<=0||d<=0)return null;var k=Fr("recharts-brush",a),j=$e.Children.count(s)===1,_=m1e("userSelect","none");return $e.createElement(cn,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,v),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(v,"endX"),(m||b||x||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 $e.createElement($e.Fragment,null,$e.createElement("rect",{x:o,y:a,width:s,height:l,fill:c,stroke:"none"}),$e.createElement("line",{x1:o+1,y1:u,x2:o+s-1,y2:u,fill:"none",stroke:"#fff"}),$e.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 $e.isValidElement(n)?a=$e.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 q4({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},a&&a.length?k1e({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}}])})(S.PureComponent);Ws(Km,"displayName","Brush");Ws(Km,"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 $4,v7;function _1e(){if(v7)return $4;v7=1;var e=lP();function t(r,n){var o;return e(r,function(a,s,l){return o=n(a,s,l),!o}),!!o}return $4=t,$4}var U4,y7;function C1e(){if(y7)return U4;y7=1;var e=BH(),t=fu(),r=_1e(),n=vs(),o=ES();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 U4=a,U4}var E1e=C1e();const A1e=dn(E1e);var ou=function(t,r){var n=t.alwaysShow,o=t.ifOverflow;return n&&(o="extendDomain"),o===r},H4,x7;function T1e(){if(x7)return H4;x7=1;var e=iV();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return H4=t,H4}var V4,b7;function P1e(){if(b7)return V4;b7=1;var e=T1e(),t=rV(),r=fu();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 V4=n,V4}var I1e=P1e();const O1e=dn(I1e);var Y4,w7;function N1e(){if(w7)return Y4;w7=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 q1e(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 $1e(e,t){var r=e.x,n=e.y,o=W1e(e,z1e),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 Ty(Ty(Ty(Ty(Ty({},t),o),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function _7(e){return $e.createElement(MY,VA({shapeType:"rectangle",propTransformer:$1e,activeClassName:"recharts-active-bar"},e))}var U1e=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||Ph(),r)}},H1e=["value","background"],VY;function Qm(e){"@babel/helpers - typeof";return Qm=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},Qm(e)}function V1e(e,t){if(e==null)return{};var r=Y1e(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 Y1e(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 aw(){return aw=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(M)0&&Math.abs(F)0&&(R=Math.min((G||0)-(F[U-1]||0),R))}),Number.isFinite(R)){var M=R/I,Y=m.layout==="vertical"?n.height:n.width;if(m.padding==="gap"&&(A=M*Y/2),m.padding==="no-gap"){var X=Ua(t.barCategoryGap,M*Y),$=M*Y/2;A=$-X-($-X)/Y*X}}}o==="xAxis"?P=[n.left+(k.left||0)+(A||0),n.left+n.width-(k.right||0)-(A||0)]:o==="yAxis"?P=c==="horizontal"?[n.top+n.height-(k.bottom||0),n.top+(k.top||0)]:[n.top+(k.top||0)+(A||0),n.top+n.height-(k.bottom||0)-(A||0)]:P=m.range,_&&(P=[P[1],P[0]]);var ee=mY(m,a,h),V=ee.scale,D=ee.realScaleType;V.domain(x).range(P),vY(V);var z=yY(V,nc(nc({},m),{},{realScaleType:D}));o==="xAxis"?(C=b==="top"&&!j||b==="bottom"&&j,N=n.left,O=f[T]-C*m.height):o==="yAxis"&&(C=b==="left"&&!j||b==="right"&&j,N=f[T]-C*m.width,O=n.top);var q=nc(nc(nc({},m),z),{},{realScaleType:D,x:N,y:O,scale:V,width:o==="xAxis"?n.width:m.width,height:o==="yAxis"?n.height:m.height});return q.bandSize=$2(q,z),!m.hide&&o==="xAxis"?f[T]+=(C?-1:1)*q.height:m.hide||(f[T]+=(C?-1:1)*q.width),nc(nc({},p),{},YS({},v,q))},{})},XY=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)}},i2e=function(t){var r=t.x1,n=t.y1,o=t.x2,a=t.y2;return XY({x:r,y:n},{x:o,y:a})},ZY=(function(){function e(t){t2e(this,e),this.scale=t}return r2e(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)}}])})();YS(ZY,"EPS",1e-4);var zP=function(t){var r=Object.keys(t).reduce(function(n,o){return nc(nc({},n),{},YS({},o,ZY.create(t[o])))},{});return nc(nc({},r),{},{apply:function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.bandAware,l=a.position;return O1e(o,function(c,u){return r[u].apply(c,{bandAware:s,position:l})})},isInRange:function(o){return HY(o,function(a,s){return r[s].isInRange(a)})}})};function o2e(e){return(e%180+180)%180}var a2e=function(t){var r=t.width,n=t.height,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=o2e(o),s=a*Math.PI/180,l=Math.atan(n/r),c=s>l&&s-1?c[u?a[d]:d]:void 0}}return Q4=n,Q4}var X4,I7;function l2e(){if(I7)return X4;I7=1;var e=WY();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return X4=t,X4}var Z4,O7;function c2e(){if(O7)return Z4;O7=1;var e=XH(),t=fu(),r=l2e(),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 Z4=o,Z4}var J4,N7;function u2e(){if(N7)return J4;N7=1;var e=s2e(),t=c2e(),r=e(t);return J4=r,J4}var d2e=u2e();const f2e=dn(d2e);var p2e=pH();const h2e=dn(p2e);var g2e=h2e(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("")}),MP=S.createContext(void 0),DP=S.createContext(void 0),JY=S.createContext(void 0),eG=S.createContext({}),tG=S.createContext(void 0),rG=S.createContext(0),nG=S.createContext(0),R7=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=g2e(a);return $e.createElement(MP.Provider,{value:n},$e.createElement(DP.Provider,{value:o},$e.createElement(eG.Provider,{value:a},$e.createElement(JY.Provider,{value:d},$e.createElement(tG.Provider,{value:s},$e.createElement(rG.Provider,{value:u},$e.createElement(nG.Provider,{value:c},l)))))))},m2e=function(){return S.useContext(tG)},iG=function(t){var r=S.useContext(MP);r==null&&Ph();var n=r[t];return n==null&&Ph(),n},v2e=function(){var t=S.useContext(MP);return Cf(t)},y2e=function(){var t=S.useContext(DP),r=f2e(t,function(n){return HY(n.domain,Number.isFinite)});return r||Cf(t)},oG=function(t){var r=S.useContext(DP);r==null&&Ph();var n=r[t];return n==null&&Ph(),n},x2e=function(){var t=S.useContext(JY);return t},b2e=function(){return S.useContext(eG)},BP=function(){return S.useContext(nG)},WP=function(){return S.useContext(rG)};function Xm(e){"@babel/helpers - typeof";return Xm=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},Xm(e)}function w2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S2e(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 nwe(e,t){return fG(e,t+1)}function iwe(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 v=n==null?void 0:n[c];if(v===void 0)return{v:fG(n,u)};var m=c,b,x=function(){return b===void 0&&(b=r(v,m)),b},w=v.coordinate,k=c===0||dw(e,w,x,d,l);k||(c=0,d=s,u+=1),k&&(d=w+e*(x()/2+o),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function sb(e){"@babel/helpers - typeof";return sb=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},sb(e)}function q7(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 ga(e){for(var t=1;t0?p.coordinate-b*e:p.coordinate})}else a[h]=p=ga(ga({},p),{},{tickCoord:p.coordinate});var x=dw(e,p.tickCoord,m,l,c);x&&(c=p.tickCoord-e*(m()/2+o),a[h]=ga(ga({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return a}function cwe(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=ga(ga({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=dw(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+o),s[l-1]=ga(ga({},d),{},{isShow:!0}))}for(var v=a?l-1:l,m=function(w){var k=s[w],j,_=function(){return j===void 0&&(j=r(k,w)),j};if(w===0){var T=e*(k.coordinate-e*_()/2-c);s[w]=k=ga(ga({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else s[w]=k=ga(ga({},k),{},{tickCoord:k.coordinate});var A=dw(e,k.tickCoord,_,c,u);A&&(c=k.tickCoord+e*(_()/2+o),s[w]=ga(ga({},k),{},{isShow:!0}))},b=0;b=2?$a(o[1].coordinate-o[0].coordinate):1,x=rwe(a,b,p);return c==="equidistantPreserveStart"?iwe(b,x,m,o,s):(c==="preserveStart"||c==="preserveStartEnd"?h=cwe(b,x,m,o,s,c==="preserveStartEnd"):h=lwe(b,x,m,o,s),h.filter(function(w){return w.isShow}))}var uwe=["viewBox"],dwe=["viewBox"],fwe=["ticks"];function ev(e){"@babel/helpers - typeof";return ev=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},ev(e)}function om(){return om=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 pwe(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 hwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U7(e,t){for(var r=0;r0?c(this.props):c(p)),s<=0||l<=0||!v||!v.length?null:$e.createElement(cn,{className:Fr("recharts-cartesian-axis",u),ref:function(b){n.layerReference=b}},a&&this.renderAxisLine(),this.renderTicks(v,this.state.fontSize,this.state.letterSpacing),Fo.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,o,a){var s;return $e.isValidElement(n)?s=$e.cloneElement(n,o):Ar(n)?s=n(o):s=$e.createElement(Ah,om({},o,{className:"recharts-cartesian-axis-tick-value"}),a),s}}])})(S.Component);HP(Nv,"displayName","CartesianAxis");HP(Nv,"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 wwe=["x1","y1","x2","y2","key"],Swe=["offset"];function Ih(e){"@babel/helpers - typeof";return Ih=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},Ih(e)}function H7(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 ya(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cwe(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 Ewe=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 $e.createElement("rect",{x:o,y:a,ry:c,width:s,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function gG(e,t){var r;if($e.isValidElement(e))r=$e.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=V7(t,wwe),u=yr(c,!1);u.offset;var d=V7(u,Swe);r=$e.createElement("line",dh({},d,{x1:n,y1:o,x2:a,y2:s,fill:"none",key:l}))}return r}function Awe(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=ya(ya({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return gG(o,u)});return $e.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Twe(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=ya(ya({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return gG(o,u)});return $e.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function Pwe(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 v=!d[p+1],m=v?o+s-h:d[p+1]-h;if(m<=0)return null;var b=p%t.length;return $e.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:m,width:a,stroke:"none",fill:t[b],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return $e.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Iwe(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 v=!d[p+1],m=v?a+l-h:d[p+1]-h;if(m<=0)return null;var b=p%n.length;return $e.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:c,stroke:"none",fill:n[b],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return $e.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Owe=function(t,r){var n=t.xAxis,o=t.width,a=t.height,s=t.offset;return gY(UP(ya(ya(ya({},Nv.defaultProps),n),{},{ticks:sd(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.left,s.left+s.width,r)},Nwe=function(t,r){var n=t.yAxis,o=t.width,a=t.height,s=t.offset;return gY(UP(ya(ya(ya({},Nv.defaultProps),n),{},{ticks:sd(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.top,s.top+s.height,r)},Bg={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function t6(e){var t,r,n,o,a,s,l=BP(),c=WP(),u=b2e(),d=ya(ya({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Bg.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Bg.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Bg.horizontal,horizontalFill:(o=e.horizontalFill)!==null&&o!==void 0?o:Bg.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:Bg.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Bg.verticalFill,x:qt(e.x)?e.x:u.left,y:qt(e.y)?e.y:u.top,width:qt(e.width)?e.width:u.width,height:qt(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,v=d.height,m=d.syncWithTicks,b=d.horizontalValues,x=d.verticalValues,w=v2e(),k=y2e();if(!qt(p)||p<=0||!qt(v)||v<=0||!qt(f)||f!==+f||!qt(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||Owe,_=d.horizontalCoordinatesGenerator||Nwe,T=d.horizontalPoints,A=d.verticalPoints;if((!T||!T.length)&&Ar(_)){var P=b&&b.length,N=_({yAxis:k?ya(ya({},k),{},{ticks:P?b:k.ticks}):void 0,width:l,height:c,offset:u},P?!0:m);dc(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ih(N),"]")),Array.isArray(N)&&(T=N)}if((!A||!A.length)&&Ar(j)){var O=x&&x.length,C=j({xAxis:w?ya(ya({},w),{},{ticks:O?x:w.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);dc(Array.isArray(C),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ih(C),"]")),Array.isArray(C)&&(A=C)}return $e.createElement("g",{className:"recharts-cartesian-grid"},$e.createElement(Ewe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),$e.createElement(Awe,dh({},d,{offset:u,horizontalPoints:T,xAxis:w,yAxis:k})),$e.createElement(Twe,dh({},d,{offset:u,verticalPoints:A,xAxis:w,yAxis:k})),$e.createElement(Pwe,dh({},d,{horizontalPoints:T})),$e.createElement(Iwe,dh({},d,{verticalPoints:A})))}t6.displayName="CartesianGrid";var Rwe=["type","layout","connectNulls","ref"],Lwe=["key"];function tv(e){"@babel/helpers - typeof";return tv=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},tv(e)}function Y7(e,t){if(e==null)return{};var r=Fwe(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 Fwe(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 cx(){return cx=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(Wg(c.slice(0,v)),[f-m]);break}var b=p.length%2===0?[0,h]:[h];return[].concat(Wg(t.repeat(c,d)),Wg(p),b).map(function(x){return"".concat(x,"px")}).join(", ")}),ic(r,"id",Av("recharts-line-")),ic(r,"pathRef",function(s){r.mainCurve=s}),ic(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ic(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Vwe(t,e),qwe(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,Bb);if(!f)return null;var h=function(m,b){return{x:m.x,y:m.y,value:m.value,errorVal:po(m.payload,b)}},p={clipPath:n?"url(#clipPath-".concat(o,")"):null};return $e.createElement(cn,p,f.map(function(v){return $e.cloneElement(v,{key:"bar-".concat(v.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=yr(this.props,!1),h=yr(c,!0),p=u.map(function(m,b){var x=Bs(Bs(Bs({key:"dot-".concat(b),r:3},f),h),{},{index:b,cx:m.x,cy:m.y,value:m.value,dataKey:d,payload:m.payload,points:u});return t.renderDotItem(c,x)}),v={clipPath:n?"url(#clipPath-".concat(o?"":"dots-").concat(a,")"):null};return $e.createElement(cn,cx({className:"recharts-line-dots",key:"dots"},v),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=Y7(l,Rwe),h=Bs(Bs(Bs({},yr(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 $e.createElement(V2,cx({},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,v=s.animateNewValues,m=s.width,b=s.height,x=this.state,w=x.prevPoints,k=x.totalLength;return $e.createElement(lu,{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(j){var _=j.t;if(w){var T=w.length/l.length,A=l.map(function(I,R){var F=Math.floor(R*T);if(w[F]){var M=w[F],Y=$s(M.x,I.x),X=$s(M.y,I.y);return Bs(Bs({},I),{},{x:Y(_),y:X(_)})}if(v){var $=$s(m*2,I.x),ee=$s(b/2,I.y);return Bs(Bs({},I),{},{x:$(_),y:ee(_)})}return Bs(Bs({},I),{},{x:I.x,y:I.y})});return a.renderCurveStatically(A,n,o)}var P=$s(0,k),N=P(_),O;if(c){var C="".concat(c).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});O=a.getStrokeDasharray(N,k,C)}else O=a.generateSimpleStrokeDasharray(k,N);return a.renderCurveStatically(l,n,o,{strokeDasharray:O})})}},{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||!Db(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,v=o.height,m=o.isAnimationActive,b=o.id;if(a||!l||!l.length)return null;var x=this.state.isAnimationFinished,w=l.length===1,k=Fr("recharts-line",c),j=u&&u.allowDataOverflow,_=d&&d.allowDataOverflow,T=j||_,A=Rr(b)?this.id:b,P=(n=yr(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},N=P.r,O=N===void 0?3:N,C=P.strokeWidth,I=C===void 0?2:C,R=jce(s)?s:{},F=R.clipDot,M=F===void 0?!0:F,Y=O*2+I;return $e.createElement(cn,{className:k},j||_?$e.createElement("defs",null,$e.createElement("clipPath",{id:"clipPath-".concat(A)},$e.createElement("rect",{x:j?h:h-p/2,y:_?f:f-v/2,width:j?p:p*2,height:_?v:v*2})),!M&&$e.createElement("clipPath",{id:"clipPath-dots-".concat(A)},$e.createElement("rect",{x:h-Y/2,y:f-Y/2,width:p+Y,height:v+Y}))):null,!w&&this.renderCurve(T,A),this.renderErrorBar(T,A),(w||s)&&this.renderDots(T,M,A),(!m||x)&&gd.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(Wg(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 FSe(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 zSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MSe(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&qt(o)&&qt(a)?t.slice(o,a+1):[]};function PG(e){return e==="number"?[0,"auto"]:void 0}var f6=function(t,r,n,o){var a=t.graphicalItems,s=t.tooltipAxis,l=ZS(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=v2(p,s.dataKey,o)}else h=f&&f[n]||l[n];return h?[].concat(lv(c),[bY(u,h)]):c},[])},rB=function(t,r,n,o){var a=o||{x:t.chartX,y:t.chartY},s=QSe(a,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=xve(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=f6(t,r,d,f),p=XSe(n,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},ZSe=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=hY(d,a);return n.reduce(function(v,m){var b,x=m.type.defaultProps!==void 0?kt(kt({},m.type.defaultProps),m.props):m.props,w=x.type,k=x.dataKey,j=x.allowDataOverflow,_=x.allowDuplicatedCategory,T=x.scale,A=x.ticks,P=x.includeHidden,N=x[s];if(v[N])return v;var O=ZS(t.data,{graphicalItems:o.filter(function(z){var q,G=s in z.props?z.props[s]:(q=z.type.defaultProps)===null||q===void 0?void 0:q[s];return G===N}),dataStartIndex:c,dataEndIndex:u}),C=O.length,I,R,F;kSe(x.domain,j,w)&&(I=_A(x.domain,null,j),p&&(w==="number"||T!=="auto")&&(F=ox(O,k,"category")));var M=PG(w);if(!I||I.length===0){var Y,X=(Y=x.domain)!==null&&Y!==void 0?Y:M;if(k){if(I=ox(O,k,w),w==="category"&&p){var $=hce(I);_&&$?(R=I,I=nw(0,C)):_||(I=iD(X,I,m).reduce(function(z,q){return z.indexOf(q)>=0?z:[].concat(lv(z),[q])},[]))}else if(w==="category")_?I=I.filter(function(z){return z!==""&&!Rr(z)}):I=iD(X,I,m).reduce(function(z,q){return z.indexOf(q)>=0||q===""||Rr(q)?z:[].concat(lv(z),[q])},[]);else if(w==="number"){var ee=kve(O,o.filter(function(z){var q,G,U=s in z.props?z.props[s]:(q=z.type.defaultProps)===null||q===void 0?void 0:q[s],Q="hide"in z.props?z.props.hide:(G=z.type.defaultProps)===null||G===void 0?void 0:G.hide;return U===N&&(P||!Q)}),k,a,d);ee&&(I=ee)}p&&(w==="number"||T!=="auto")&&(F=ox(O,k,"category"))}else p?I=nw(0,C):l&&l[N]&&l[N].hasStack&&w==="number"?I=h==="expand"?[0,1]:xY(l[N].stackGroups,c,u):I=pY(O,o.filter(function(z){var q=s in z.props?z.props[s]:z.type.defaultProps[s],G="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return q===N&&(P||!G)}),w,d,!0);if(w==="number")I=c6(f,I,N,a,A),X&&(I=_A(X,I,j));else if(w==="category"&&X){var V=X,D=I.every(function(z){return V.indexOf(z)>=0});D&&(I=V)}}return kt(kt({},v),{},br({},N,kt(kt({},x),{},{axisType:a,domain:I,categoricalDomain:F,duplicateDomain:R,originalDomain:(b=x.domain)!==null&&b!==void 0?b:M,isCategorical:p,layout:d})))},{})},JSe=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=ZS(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=h.length,v=hY(d,a),m=-1;return n.reduce(function(b,x){var w=x.type.defaultProps!==void 0?kt(kt({},x.type.defaultProps),x.props):x.props,k=w[s],j=PG("number");if(!b[k]){m++;var _;return v?_=nw(0,p):l&&l[k]&&l[k].hasStack?(_=xY(l[k].stackGroups,c,u),_=c6(f,_,k,a)):(_=_A(j,pY(h,n.filter(function(T){var A,P,N=s in T.props?T.props[s]:(A=T.type.defaultProps)===null||A===void 0?void 0:A[s],O="hide"in T.props?T.props.hide:(P=T.type.defaultProps)===null||P===void 0?void 0:P.hide;return N===k&&!O}),"number",d),o.defaultProps.allowDataOverflow),_=c6(f,_,k,a)),kt(kt({},b),{},br({},k,kt(kt({axisType:a},o.defaultProps),{},{hide:!0,orientation:Gs(GSe,"".concat(a,".").concat(m%2),null),domain:_,originalDomain:j,isCategorical:v,layout:d})))}return b},{})},eje=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=ZSe(t,{axes:h,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=JSe(t,{Axis:a,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},tje=function(t){var r=Cf(t),n=sd(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:cP(n,function(o){return o.coordinate}),tooltipAxis:r,tooltipAxisBandSize:$2(r,n)}},nB=function(t){var r=t.children,n=t.defaultShowTooltip,o=qs(r,Km),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}},rje=function(t){return!t||!t.length?!1:t.some(function(r){var n=pd(r&&r.type);return n&&n.indexOf("Bar")>=0})},iB=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"}},nje=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=qs(f,Km),v=qs(f,Ff),m=Object.keys(c).reduce(function(_,T){var A=c[T],P=A.orientation;return!A.mirror&&!A.hide?kt(kt({},_),{},br({},P,_[P]+A.width)):_},{left:h.left||0,right:h.right||0}),b=Object.keys(s).reduce(function(_,T){var A=s[T],P=A.orientation;return!A.mirror&&!A.hide?kt(kt({},_),{},br({},P,Gs(_,"".concat(P))+A.height)):_},{top:h.top||0,bottom:h.bottom||0}),x=kt(kt({},b),m),w=x.bottom;p&&(x.bottom+=p.props.height||Km.defaultProps.height),v&&r&&(x=Sve(x,o,n,r));var k=u-x.left-x.right,j=d-x.top-x.bottom;return kt(kt({brushBottom:w},x),{},{width:Math.max(k,0),height:Math.max(j,0)})},ije=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},VP=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(x,w){var k=w.graphicalItems,j=w.stackGroups,_=w.offset,T=w.updateId,A=w.dataStartIndex,P=w.dataEndIndex,N=x.barSize,O=x.layout,C=x.barGap,I=x.barCategoryGap,R=x.maxBarSize,F=iB(O),M=F.numericAxisName,Y=F.cateAxisName,X=rje(k),$=[];return k.forEach(function(ee,V){var D=ZS(x.data,{graphicalItems:[ee],dataStartIndex:A,dataEndIndex:P}),z=ee.type.defaultProps!==void 0?kt(kt({},ee.type.defaultProps),ee.props):ee.props,q=z.dataKey,G=z.maxBarSize,U=z["".concat(M,"Id")],Q=z["".concat(Y,"Id")],K={},re=c.reduce(function(Se,Pe){var Ee=w["".concat(Pe.axisType,"Map")],Ae=z["".concat(Pe.axisType,"Id")];Ee&&Ee[Ae]||Pe.axisType==="zAxis"||Ph();var Ye=Ee[Ae];return kt(kt({},Se),{},br(br({},Pe.axisType,Ye),"".concat(Pe.axisType,"Ticks"),sd(Ye)))},K),H=re[Y],ie=re["".concat(Y,"Ticks")],de=j&&j[U]&&j[U].hasStack&&Nve(ee,j[U].stackGroups),le=pd(ee.type).indexOf("Bar")>=0,ke=$2(H,ie),ve=[],se=X&&bve({barSize:N,stackGroups:j,totalSize:ije(re,Y)});if(le){var be,De,ae=Rr(G)?R:G,ue=(be=(De=$2(H,ie,!0))!==null&&De!==void 0?De:ae)!==null&&be!==void 0?be:0;ve=wve({barGap:C,barCategoryGap:I,bandSize:ue!==ke?ue:ke,sizeList:se[Q],maxBarSize:ae}),ue!==ke&&(ve=ve.map(function(Se){return kt(kt({},Se),{},{position:kt(kt({},Se.position),{},{offset:Se.position.offset-ue/2})})}))}var Me=ee&&ee.type&&ee.type.getComposedData;Me&&$.push({props:kt(kt({},Me(kt(kt({},re),{},{displayedData:D,props:x,dataKey:q,item:ee,bandSize:ke,barPosition:ve,offset:_,stackedData:de,layout:O,dataStartIndex:A,dataEndIndex:P}))),{},br(br(br({key:ee.key||"item-".concat(V)},M,re[M]),Y,re[Y]),"animationId",T)),childIndex:Cce(ee,x.children),item:ee})}),$},p=function(x,w){var k=x.props,j=x.dataStartIndex,_=x.dataEndIndex,T=x.updateId;if(!yL({props:k}))return null;var A=k.children,P=k.layout,N=k.stackOffset,O=k.data,C=k.reverseStackOrder,I=iB(P),R=I.numericAxisName,F=I.cateAxisName,M=Ks(A,n),Y=Ive(O,M,"".concat(R,"Id"),"".concat(F,"Id"),N,C),X=c.reduce(function(z,q){var G="".concat(q.axisType,"Map");return kt(kt({},z),{},br({},G,eje(k,kt(kt({},q),{},{graphicalItems:M,stackGroups:q.axisType===R&&Y,dataStartIndex:j,dataEndIndex:_}))))},{}),$=nje(kt(kt({},X),{},{props:k,graphicalItems:M}),w==null?void 0:w.legendBBox);Object.keys(X).forEach(function(z){X[z]=d(k,X[z],$,z.replace("Map",""),r)});var ee=X["".concat(F,"Map")],V=tje(ee),D=h(k,kt(kt({},X),{},{dataStartIndex:j,dataEndIndex:_,updateId:T,graphicalItems:M,stackGroups:Y,offset:$}));return kt(kt({formattedGraphicalItems:D,graphicalItems:M,offset:$,stackGroups:Y},V),X)},v=(function(b){function x(w){var k,j,_;return zSe(this,x),_=BSe(this,x,[w]),br(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),br(_,"accessibilityManager",new jSe),br(_,"handleLegendBBoxUpdate",function(T){if(T){var A=_.state,P=A.dataStartIndex,N=A.dataEndIndex,O=A.updateId;_.setState(kt({legendBBox:T},p({props:_.props,dataStartIndex:P,dataEndIndex:N,updateId:O},kt(kt({},_.state),{},{legendBBox:T}))))}}),br(_,"handleReceiveSyncEvent",function(T,A,P){if(_.props.syncId===T){if(P===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(A)}}),br(_,"handleBrushChange",function(T){var A=T.startIndex,P=T.endIndex;if(A!==_.state.dataStartIndex||P!==_.state.dataEndIndex){var N=_.state.updateId;_.setState(function(){return kt({dataStartIndex:A,dataEndIndex:P},p({props:_.props,dataStartIndex:A,dataEndIndex:P,updateId:N},_.state))}),_.triggerSyncEvent({dataStartIndex:A,dataEndIndex:P})}}),br(_,"handleMouseEnter",function(T){var A=_.getMouseInfo(T);if(A){var P=kt(kt({},A),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var N=_.props.onMouseEnter;Ar(N)&&N(P,T)}}),br(_,"triggeredAfterMouseMove",function(T){var A=_.getMouseInfo(T),P=A?kt(kt({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(P),_.triggerSyncEvent(P);var N=_.props.onMouseMove;Ar(N)&&N(P,T)}),br(_,"handleItemMouseEnter",function(T){_.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),br(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),br(_,"handleMouseMove",function(T){T.persist(),_.throttleTriggeredAfterMouseMove(T)}),br(_,"handleMouseLeave",function(T){_.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};_.setState(A),_.triggerSyncEvent(A);var P=_.props.onMouseLeave;Ar(P)&&P(A,T)}),br(_,"handleOuterEvent",function(T){var A=_ce(T),P=Gs(_.props,"".concat(A));if(A&&Ar(P)){var N,O;/.*touch.*/i.test(A)?O=_.getMouseInfo(T.changedTouches[0]):O=_.getMouseInfo(T),P((N=O)!==null&&N!==void 0?N:{},T)}}),br(_,"handleClick",function(T){var A=_.getMouseInfo(T);if(A){var P=kt(kt({},A),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var N=_.props.onClick;Ar(N)&&N(P,T)}}),br(_,"handleMouseDown",function(T){var A=_.props.onMouseDown;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleMouseUp",function(T){var A=_.props.onMouseUp;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),br(_,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.handleMouseDown(T.changedTouches[0])}),br(_,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.handleMouseUp(T.changedTouches[0])}),br(_,"handleDoubleClick",function(T){var A=_.props.onDoubleClick;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleContextMenu",function(T){var A=_.props.onContextMenu;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"triggerSyncEvent",function(T){_.props.syncId!==void 0&&rE.emit(nE,_.props.syncId,T,_.eventEmitterSymbol)}),br(_,"applySyncEvent",function(T){var A=_.props,P=A.layout,N=A.syncMethod,O=_.state.updateId,C=T.dataStartIndex,I=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)_.setState(kt({dataStartIndex:C,dataEndIndex:I},p({props:_.props,dataStartIndex:C,dataEndIndex:I,updateId:O},_.state)));else if(T.activeTooltipIndex!==void 0){var R=T.chartX,F=T.chartY,M=T.activeTooltipIndex,Y=_.state,X=Y.offset,$=Y.tooltipTicks;if(!X)return;if(typeof N=="function")M=N($,T);else if(N==="value"){M=-1;for(var ee=0;ee<$.length;ee++)if($[ee].value===T.activeLabel){M=ee;break}}var V=kt(kt({},X),{},{x:X.left,y:X.top}),D=Math.min(R,V.x+V.width),z=Math.min(F,V.y+V.height),q=$[M]&&$[M].value,G=f6(_.state,_.props.data,M),U=$[M]?{x:P==="horizontal"?$[M].coordinate:D,y:P==="horizontal"?z:$[M].coordinate}:TG;_.setState(kt(kt({},T),{},{activeLabel:q,activeCoordinate:U,activePayload:G,activeTooltipIndex:M}))}else _.setState(T)}),br(_,"renderCursor",function(T){var A,P=_.state,N=P.isTooltipActive,O=P.activeCoordinate,C=P.activePayload,I=P.offset,R=P.activeTooltipIndex,F=P.tooltipAxisBandSize,M=_.getTooltipEventType(),Y=(A=T.props.active)!==null&&A!==void 0?A:N,X=_.props.layout,$=T.key||"_recharts-cursor";return $e.createElement(PSe,{key:$,activeCoordinate:O,activePayload:C,activeTooltipIndex:R,chartName:r,element:T,isActive:Y,layout:X,offset:I,tooltipAxisBandSize:F,tooltipEventType:M})}),br(_,"renderPolarAxis",function(T,A,P){var N=Gs(T,"type.axisType"),O=Gs(_.state,"".concat(N,"Map")),C=T.type.defaultProps,I=C!==void 0?kt(kt({},C),T.props):T.props,R=O&&O[I["".concat(N,"Id")]];return S.cloneElement(T,kt(kt({},R),{},{className:Fr(N,R.className),key:T.key||"".concat(A,"-").concat(P),ticks:sd(R,!0)}))}),br(_,"renderPolarGrid",function(T){var A=T.props,P=A.radialLines,N=A.polarAngles,O=A.polarRadius,C=_.state,I=C.radiusAxisMap,R=C.angleAxisMap,F=Cf(I),M=Cf(R),Y=M.cx,X=M.cy,$=M.innerRadius,ee=M.outerRadius;return S.cloneElement(T,{polarAngles:Array.isArray(N)?N:sd(M,!0).map(function(V){return V.coordinate}),polarRadius:Array.isArray(O)?O:sd(F,!0).map(function(V){return V.coordinate}),cx:Y,cy:X,innerRadius:$,outerRadius:ee,key:T.key||"polar-grid",radialLines:P})}),br(_,"renderLegend",function(){var T=_.state.formattedGraphicalItems,A=_.props,P=A.children,N=A.width,O=A.height,C=_.props.margin||{},I=N-(C.left||0)-(C.right||0),R=dY({children:P,formattedGraphicalItems:T,legendWidth:I,legendContent:u});if(!R)return null;var F=R.item,M=eB(R,ISe);return S.cloneElement(F,kt(kt({},M),{},{chartWidth:N,chartHeight:O,margin:C,onBBoxUpdate:_.handleLegendBBoxUpdate}))}),br(_,"renderTooltip",function(){var T,A=_.props,P=A.children,N=A.accessibilityLayer,O=qs(P,Tl);if(!O)return null;var C=_.state,I=C.isTooltipActive,R=C.activeCoordinate,F=C.activePayload,M=C.activeLabel,Y=C.offset,X=(T=O.props.active)!==null&&T!==void 0?T:I;return S.cloneElement(O,{viewBox:kt(kt({},Y),{},{x:Y.left,y:Y.top}),active:X,label:M,payload:X?F:[],coordinate:R,accessibilityLayer:N})}),br(_,"renderBrush",function(T){var A=_.props,P=A.margin,N=A.data,O=_.state,C=O.offset,I=O.dataStartIndex,R=O.dataEndIndex,F=O.updateId;return S.cloneElement(T,{key:T.key||"_recharts-brush",onChange:s1(_.handleBrushChange,T.props.onChange),data:N,x:qt(T.props.x)?T.props.x:C.left,y:qt(T.props.y)?T.props.y:C.top+C.height+C.brushBottom-(P.bottom||0),width:qt(T.props.width)?T.props.width:C.width,startIndex:I,endIndex:R,updateId:"brush-".concat(F)})}),br(_,"renderReferenceElement",function(T,A,P){if(!T)return null;var N=_,O=N.clipPathId,C=_.state,I=C.xAxisMap,R=C.yAxisMap,F=C.offset,M=T.type.defaultProps||{},Y=T.props,X=Y.xAxisId,$=X===void 0?M.xAxisId:X,ee=Y.yAxisId,V=ee===void 0?M.yAxisId:ee;return S.cloneElement(T,{key:T.key||"".concat(A,"-").concat(P),xAxis:I[$],yAxis:R[V],viewBox:{x:F.left,y:F.top,width:F.width,height:F.height},clipPathId:O})}),br(_,"renderActivePoints",function(T){var A=T.item,P=T.activePoint,N=T.basePoint,O=T.childIndex,C=T.isRange,I=[],R=A.props.key,F=A.item.type.defaultProps!==void 0?kt(kt({},A.item.type.defaultProps),A.item.props):A.item.props,M=F.activeDot,Y=F.dataKey,X=kt(kt({index:O,dataKey:Y,cx:P.x,cy:P.y,r:4,fill:LP(A.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},yr(M,!1)),y2(M));return I.push(x.renderActiveDot(M,X,"".concat(R,"-activePoint-").concat(O))),N?I.push(x.renderActiveDot(M,kt(kt({},X),{},{cx:N.x,cy:N.y}),"".concat(R,"-basePoint-").concat(O))):C&&I.push(null),I}),br(_,"renderGraphicChild",function(T,A,P){var N=_.filterFormatItem(T,A,P);if(!N)return null;var O=_.getTooltipEventType(),C=_.state,I=C.isTooltipActive,R=C.tooltipAxis,F=C.activeTooltipIndex,M=C.activeLabel,Y=_.props.children,X=qs(Y,Tl),$=N.props,ee=$.points,V=$.isRange,D=$.baseLine,z=N.item.type.defaultProps!==void 0?kt(kt({},N.item.type.defaultProps),N.item.props):N.item.props,q=z.activeDot,G=z.hide,U=z.activeBar,Q=z.activeShape,K=!!(!G&&I&&X&&(q||U||Q)),re={};O!=="axis"&&X&&X.props.trigger==="click"?re={onClick:s1(_.handleItemMouseEnter,T.props.onClick)}:O!=="axis"&&(re={onMouseLeave:s1(_.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:s1(_.handleItemMouseEnter,T.props.onMouseEnter)});var H=S.cloneElement(T,kt(kt({},N.props),re));function ie(Pe){return typeof R.dataKey=="function"?R.dataKey(Pe.payload):null}if(K)if(F>=0){var de,le;if(R.dataKey&&!R.allowDuplicatedCategory){var ke=typeof R.dataKey=="function"?ie:"payload.".concat(R.dataKey.toString());de=v2(ee,ke,M),le=V&&D&&v2(D,ke,M)}else de=ee==null?void 0:ee[F],le=V&&D&&D[F];if(Q||U){var ve=T.props.activeIndex!==void 0?T.props.activeIndex:F;return[S.cloneElement(T,kt(kt(kt({},N.props),re),{},{activeIndex:ve})),null,null]}if(!Rr(de))return[H].concat(lv(_.renderActivePoints({item:N,activePoint:de,basePoint:le,childIndex:F,isRange:V})))}else{var se,be=(se=_.getItemByXY(_.state.activeCoordinate))!==null&&se!==void 0?se:{graphicalItem:H},De=be.graphicalItem,ae=De.item,ue=ae===void 0?T:ae,Me=De.childIndex,Se=kt(kt(kt({},N.props),re),{},{activeIndex:Me});return[S.cloneElement(ue,Se),null,null]}return V?[H,null,null]:[H,null]}),br(_,"renderCustomized",function(T,A,P){return S.cloneElement(T,kt(kt({key:"recharts-customized-".concat(P)},_.props),_.state))}),br(_,"renderMap",{CartesianGrid:{handler:f1,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:f1},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:f1},YAxis:{handler:f1},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:Av("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=uV(_.triggeredAfterMouseMove,(j=w.throttleDelay)!==null&&j!==void 0?j:1e3/60),_.state={},_}return $Se(x,b),DSe(x,[{key:"componentDidMount",value:function(){var k,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var k=this.props,j=k.children,_=k.data,T=k.height,A=k.layout,P=qs(j,Tl);if(P){var N=P.props.defaultIndex;if(!(typeof N!="number"||N<0||N>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[N]&&this.state.tooltipTicks[N].value,C=f6(this.state,_,N,O),I=this.state.tooltipTicks[N].coordinate,R=(this.state.offset.top+T)/2,F=A==="horizontal",M=F?{x:I,y:R}:{y:I,x:R},Y=this.state.formattedGraphicalItems.find(function($){var ee=$.item;return ee.type.name==="Scatter"});Y&&(M=kt(kt({},M),Y.props.points[N].tooltipPosition),C=Y.props.points[N].tooltipPayload);var X={activeTooltipIndex:N,isTooltipActive:!0,activeLabel:O,activePayload:C,activeCoordinate:M};this.setState(X),this.renderCursor(P),this.accessibilityManager.setIndex(N)}}}},{key:"getSnapshotBeforeUpdate",value:function(k,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.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 _,T;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(k){Y3([qs(k.children,Tl)],[qs(this.props.children,Tl)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var k=qs(this.props.children,Tl);if(k&&typeof k.props.shared=="boolean"){var j=k.props.shared?"axis":"item";return l.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(k){if(!this.container)return null;var j=this.container,_=j.getBoundingClientRect(),T=fpe(_),A={chartX:Math.round(k.pageX-T.left),chartY:Math.round(k.pageY-T.top)},P=_.width/j.offsetWidth||1,N=this.inRange(A.chartX,A.chartY,P);if(!N)return null;var O=this.state,C=O.xAxisMap,I=O.yAxisMap,R=this.getTooltipEventType(),F=rB(this.state,this.props.data,this.props.layout,N);if(R!=="axis"&&C&&I){var M=Cf(C).scale,Y=Cf(I).scale,X=M&&M.invert?M.invert(A.chartX):null,$=Y&&Y.invert?Y.invert(A.chartY):null;return kt(kt({},A),{},{xValue:X,yValue:$},F)}return F?kt(kt({},A),F):null}},{key:"inRange",value:function(k,j){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,A=k/_,P=j/_;if(T==="horizontal"||T==="vertical"){var N=this.state.offset,O=A>=N.left&&A<=N.left+N.width&&P>=N.top&&P<=N.top+N.height;return O?{x:A,y:P}:null}var C=this.state,I=C.angleAxisMap,R=C.radiusAxisMap;if(I&&R){var F=Cf(I);return sD({x:A,y:P},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var k=this.props.children,j=this.getTooltipEventType(),_=qs(k,Tl),T={};_&&j==="axis"&&(_.props.trigger==="click"?T={onClick:this.handleClick}:T={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 A=y2(this.props,this.handleOuterEvent);return kt(kt({},A),T)}},{key:"addListener",value:function(){rE.on(nE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){rE.removeListener(nE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(k,j,_){for(var T=this.state.formattedGraphicalItems,A=0,P=T.length;At?`${r.slice(0,t-1)}…`:r}function cje({loading:e,registrationTrend:t=[],quizStats:r=[],participantBreakdown:n=[],participantBreakdownSource:o="status"}){const a=Si(),s=a==="mobile",l=a==="tablet",c=s?1:l?2:3,u=s?160:180,d=S.useMemo(()=>(t??[]).map(x=>({period:x.date,Registrations:x.registrations,"Check-ins":x.checkIns})),[t]),f=S.useMemo(()=>(r??[]).slice(0,8).map(x=>({name:lje(x.title),Responses:x.responses,"Avg Score":x.avgScore??0})),[r]),h=S.useMemo(()=>(n??[]).filter(x=>x.count>0).map(x=>({name:x.label,value:x.count})),[n]),p=d.some(x=>x.Registrations>0||x["Check-ins"]>0),v=f.some(x=>x.Responses>0),m=h.length>0,b=o==="tags"?"Participants by tag":"Participants by status";return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c}, 1fr)`,gap:s?"12px":"16px"},children:[i.jsx(aE,{title:"Registration Trend",subtitle:"Registrations vs check-ins over time",children:e?i.jsx(qg,{message:"Loading…"}):p?i.jsx(l4,{width:"100%",height:u,children:i.jsxs(oje,{data:d,margin:{top:4,right:8,left:-24,bottom:0},children:[i.jsx(t6,{strokeDasharray:"3 3",stroke:"var(--border)",vertical:!1}),i.jsx(iv,{dataKey:"period",tick:h1,axisLine:!1,tickLine:!1}),i.jsx(av,{tick:h1,axisLine:!1,tickLine:!1}),i.jsx(Tl,{contentStyle:oE}),i.jsx(Ff,{iconType:"circle",iconSize:7,wrapperStyle:{fontSize:"11px",fontFamily:"var(--font-noto-sans)"}}),i.jsx(rv,{type:"monotone",dataKey:"Registrations",stroke:"var(--chart-2)",strokeWidth:2,dot:{r:3,fill:"var(--chart-2)",strokeWidth:0},activeDot:{r:5}}),i.jsx(rv,{type:"monotone",dataKey:"Check-ins",stroke:"var(--chart-1)",strokeWidth:2,dot:{r:3,fill:"var(--chart-1)",strokeWidth:0},activeDot:{r:5},strokeDasharray:"4 3"})]})}):i.jsx(qg,{message:"No registrations yet."})}),i.jsx(aE,{title:"Quiz Participation",subtitle:"Responses and average scores",children:e?i.jsx(qg,{message:"Loading…"}):v?i.jsx(l4,{width:"100%",height:u,children:i.jsxs(aje,{data:f,margin:{top:4,right:8,left:-24,bottom:0},children:[i.jsx(t6,{strokeDasharray:"3 3",stroke:"var(--border)",vertical:!1}),i.jsx(iv,{dataKey:"name",tick:h1,axisLine:!1,tickLine:!1}),i.jsx(av,{tick:h1,axisLine:!1,tickLine:!1}),i.jsx(Tl,{contentStyle:oE}),i.jsx(Ff,{iconType:"square",iconSize:7,wrapperStyle:{fontSize:"11px",fontFamily:"var(--font-noto-sans)"}}),i.jsx(Uf,{dataKey:"Responses",fill:"var(--chart-3)",radius:[3,3,0,0]}),i.jsx(Uf,{dataKey:"Avg Score",fill:"var(--chart-4)",radius:[3,3,0,0]})]})}):i.jsx(qg,{message:"No quiz responses yet."})}),i.jsx("div",{style:l?{gridColumn:"1 / -1"}:{},children:i.jsx(aE,{title:b,subtitle:"Breakdown of registered participants",children:e?i.jsx(qg,{message:"Loading…"}):m?i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[i.jsx(l4,{width:s?"45%":"50%",height:s?140:160,children:i.jsxs(sje,{children:[i.jsx(Od,{data:h,cx:"50%",cy:"50%",innerRadius:s?36:44,outerRadius:s?60:72,paddingAngle:2,dataKey:"value",children:h.map((x,w)=>i.jsx(AS,{fill:p1[w%p1.length]},`cell-${x.name}`))}),i.jsx(Tl,{contentStyle:oE})]})}),i.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"7px"},children:h.map((x,w)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[i.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:p1[w%p1.length],flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",flex:1},children:x.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:x.value})]},`legend-${x.name}`))})]}):i.jsx(qg,{message:"No participants to show yet."})})})]})}function Py({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 Iy({icon:e,title:t,color:r,onViewAll:n}){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})]}),n?i.jsxs("button",{type:"button",onClick:n,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:o=>{o.currentTarget.style.color="var(--primary)"},onMouseLeave:o=>{o.currentTarget.style.color="var(--muted)"},children:["View all ",i.jsx(ka,{size:12})]}):null]})}function oB({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 uje({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 Oy({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 dje(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||e.email||"Participant"}function fje(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m`;const n=Math.floor(r/60);return n<48?`${n}h`:`${Math.floor(n/24)}d`}function pje(e){const t=e.toLowerCase();return t.includes("keynote")||t.includes("plenary")?{bg:"#ede9fe",color:"#5b21b6"}:t.includes("workshop")?{bg:"#dcfce7",color:"#15803d"}:t.includes("panel")?{bg:"#fee2e2",color:"#b91c1c"}:t.includes("break")?{bg:"#f3f4f6",color:"#6b7280"}:{bg:"#dbeafe",color:"#1d4ed8"}}function hje({loading:e,analytics:t,onNavigate:r}){var j,_,T;const n=Si(),o=n==="mobile"?1:n==="tablet"?2:3,a=(t==null?void 0:t.quizStats)??[],s=(t==null?void 0:t.pollSummaries)??[],l=(t==null?void 0:t.leaderboardTop)??[],c=t==null?void 0:t.agendaSummary,u=(t==null?void 0:t.recentParticipants)??[],d=a.filter(A=>A.responses>0),f=a.reduce((A,P)=>A+P.questionCount,0),h=d.length>0?Math.round(d.reduce((A,P)=>A+(P.avgScore??0),0)/d.length):0,p=((j=t==null?void 0:t.statusCounts)==null?void 0:j.checked_in)??0,v=(t==null?void 0:t.participantCount)??0,m=v>0?Math.round(p/v*100):0,[b,x]=S.useState(0),w=s[b]??s[0],k=e?"—":void 0;return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, 1fr)`,gap:n==="mobile"?"12px":"16px"},children:[i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(tS,{size:15}),title:"Quiz",color:"var(--chart-3)",onViewAll:r?()=>r("event-activities"):void 0}),i.jsx(Oy,{items:[[k??String(a.length),"Active"],[k??String(f),"Questions"],[k??(d.length?`${h}%`:"—"),"Avg Score"]]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):a.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No quizzes yet."}):a.slice(0,4).map(A=>i.jsx(oB,{label:A.title,pct:A.avgScore??0,color:"var(--chart-3)"},A.id))})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(Ad,{size:15}),title:"Polls",color:"var(--chart-4)",onViewAll:r?()=>r("event-activities"):void 0}),i.jsx(Oy,{items:[[k??String((t==null?void 0:t.pollCount)??0),"Active Polls"],[k??String(s.reduce((A,P)=>A+P.totalVotes,0)),"Total Votes"]]}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):w?i.jsxs(i.Fragment,{children:[s.length>1?i.jsx("div",{style:{display:"flex",gap:"6px"},children:s.map((A,P)=>i.jsxs("button",{type:"button",onClick:()=>x(P),style:{flex:1,padding:"5px 0",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:b===P?"var(--primary)":"var(--card)",color:b===P?"#fff":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:["Poll ",P+1]},A.id))}):null,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:w.title}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"10px"},children:[w.totalVotes," votes"]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"7px"},children:w.options.length?w.options.map(A=>i.jsx(oB,{label:A.label,pct:A.pct,color:"var(--chart-4)"},A.label)):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No votes recorded yet."})})]})]}):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No polls yet."})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(nu,{size:15}),title:"Reward Points",color:"var(--chart-2)",onViewAll:r?()=>r("rewards"):void 0}),i.jsx(Oy,{items:[[k??((_=t==null?void 0:t.pointsAwarded)==null?void 0:_.toLocaleString())??"0","Total Points"],[k??String(l.length),"Earners"]]}),i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):l.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No leaderboard entries yet."}):l.slice(0,6).map((A,P)=>{const N=["🥇","🥈","🥉"],O=P<3?N[P]:String(P+1),C=dje(A);return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:Pr("agenda"):void 0}),i.jsx(Oy,{items:[[k??String((c==null?void 0:c.sessionCount)??(t==null?void 0:t.sessionCount)??0),"Sessions"],[k??String((c==null?void 0:c.dayCount)??0),"Days"],[k??String((c==null?void 0:c.speakerCount)??0),"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"}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):(T=c==null?void 0:c.todaySessions)!=null&&T.length?i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:c.todaySessions.map((A,P)=>{const N=pje(A.track);return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderBottom:Pr("participants"):void 0}),i.jsx(Oy,{items:[[k??String(v),"Registered"],[k??String(p),"Checked In"],[k??(v?`${m}%`:"—"),"Rate"]]}),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:"Recent Activity"}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):u.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No recent activity."}):i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:u.map((A,P)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:P{if(!e){o(null),s(null),d(null),c(!1);return}c(!0),d(null);try{const[p,v]=await Promise.all([Lr.get(e),Lr.analytics(e)]);if(p.error){d(typeof p.error=="string"?p.error:"Failed to load event."),o(null),s(null);return}if(o(p.data??null),v.error){d(typeof v.error=="string"?v.error:"Failed to load analytics."),s(null);return}s(v.data??null)}catch{d("Failed to load analytics."),s(null)}finally{c(!1)}},[e]);S.useEffect(()=>{f()},[f]);const h=p=>{if(p==="agenda"){t==null||t("dashboard");return}t==null||t(p)};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:l&&!n?"Loading…":(n==null?void 0:n.name)??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:r==="mobile"?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Analytics"}),u?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"8px"},children:u}):null]}),i.jsx(Cle,{loading:l,participantCount:a==null?void 0:a.participantCount,sessionCount:a==null?void 0:a.sessionCount,quizPollCount:a==null?void 0:a.quizPollCount,pointsAwarded:a==null?void 0:a.pointsAwarded,pointsRedeemed:a==null?void 0:a.pointsRedeemed,statusCounts:a==null?void 0:a.statusCounts,upcomingSessionCount:a==null?void 0:a.upcomingSessionCount}),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)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"10px"},children:"Charts"}),i.jsx(cje,{loading:l,registrationTrend:a==null?void 0:a.registrationTrend,quizStats:a==null?void 0:a.quizStats,participantBreakdown:a==null?void 0:a.participantBreakdown,participantBreakdownSource:a==null?void 0:a.participantBreakdownSource})]}),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)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"10px"},children:"Features"}),i.jsx(hje,{loading:l,analytics:a,onNavigate:t?h:void 0})]}),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"})})]}):i.jsx("div",{style:{padding:"24px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Select an event to view analytics."})}function mje(){const e="https://web.eventbuzz.live".trim()||!1;return e?e.replace(/\/+$/,""):(typeof window<"u"?window.location.origin:"").replace(/\/+$/,"")}function vje(e){return null}function yje(e){const t=mje();return!t||!e.trim()?null:`${t}/event/${e}`}const xje={conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"},aB={draft:{label:"Draft",bg:"#64748b"},upcoming:{label:"Upcoming",bg:"#2563eb"},live:{label:"Live",bg:"#16a34a"},completed:{label:"Completed",bg:"#475569"}},bje={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"};function wje(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 Sje(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 jje({event:e,loading:t=!1,onEditEvent:r,canEdit:n=!0}){var x,w,k,j,_,T,A,P,N,O;const a=Si()==="mobile",[s,l]=S.useState(!1);S.useEffect(()=>{l(!1)},[e==null?void 0:e._id,e==null?void 0:e.bannerImage,(w=(x=e==null?void 0:e.website)==null?void 0:x.banners)==null?void 0:w[0]]);const c=e?Sje(e):null,u=e!=null&&e.status&&aB[e.status]?e.status:"draft",d=aB[u],f=e!=null&&e.type?xje[e.type]??e.type:"Event",h=e!=null&&e.locationType?bje[e.locationType]??e.locationType:"",p=e!=null&&e.startDate&&(e!=null&&e.endDate)?wje(e.startDate,e.endDate):"—",v=(e==null?void 0:e.locationType)==="virtual"?((k=e.virtualLink)==null?void 0:k.trim())||"Virtual event":(e==null?void 0:e.locationType)==="hybrid"?[(j=e.location)==null?void 0:j.trim(),(_=e.virtualLink)==null?void 0:_.trim()].filter(Boolean).join(" · ")||"Hybrid":((T=e==null?void 0:e.location)==null?void 0:T.trim())||"—",m=(A=e==null?void 0:e.website)!=null&&A.folder?vje(e.website.folder):e!=null&&e._id?yje(e._id):null,b=(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?" ":((P=e==null?void 0:e.subtitle)==null?void 0:P.trim())||((O=(N=e==null?void 0:e.description)==null?void 0:N.trim())==null?void 0:O.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(bv,{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(wi,{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(Vi,{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(Ab,{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?"…":v})]}),i.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:b.dot,display:"block"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:b.dot,fontWeight:"var(--font-weight-medium)"},children:t?"…":b.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 m1({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 kje({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(bi,{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 _je({eventId:e,existingTrack:t,onClose:r,onSuccess:n}){const o=!!(t!=null&&t._id),[a,s]=S.useState(1),[l,c]=S.useState(()=>o?new Set([1,2,3]):new Set),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState((t==null?void 0:t.name)||""),[m,b]=S.useState((t==null?void 0:t.trackType)||"general"),[x,w]=S.useState((t==null?void 0:t.hall)||""),[k,j]=S.useState((t==null?void 0:t.status)||"active"),[_,T]=S.useState({}),[A,P]=S.useState({}),[N,O]=S.useState({}),C=S.useCallback(()=>{const ee={};return p.trim()?p.trim().length<2&&(ee.name="Use at least 2 characters."):ee.name="Track name is required.",T(ee),Object.keys(ee).length===0},[p]),I=S.useCallback(()=>(P({}),!0),[]),R=S.useCallback(()=>(O({}),!0),[]),F=S.useCallback(()=>{const ee=C(),V=I(),D=R();return ee&&V&&D},[C,I,R]),M=ee=>{ee===1&&!C()||ee===2&&!I()||(c(V=>new Set([...V,ee])),ee<3&&s(ee+1))},Y=async()=>{if(h(null),!F()){C()?I()?s(3):s(2):s(1);return}d(!0);const ee={name:p.trim(),hall:x.trim()||void 0,trackType:m,status:k},V=o?await dm.update(t._id,ee):await dm.create(e,ee);if(d(!1),V.error){h(V.error);return}n(),r()},X=[{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."}],$=({className:ee})=>i.jsx("button",{type:"button",disabled:u,onClick:Y,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(Gt,{size:14})}),i.jsx($,{})]})]}),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:X.map(ee=>{const V=a===ee.n,D=l.has(ee.n),z=V?"active":D?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>s(V?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(kje,{n:ee.n,state:z}),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:V?"var(--primary)":"var(--card-foreground)",margin:0},children:ee.title}),!V&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:ee.subtitle})]}),V?i.jsx(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{size:18,style:{color:"var(--muted)"}})]}),V&&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:q=>{v(q.target.value),_.name&&T({})},placeholder:"e.g. Main hall track",style:g1}),i.jsx(m1,{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:q=>b(q.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(m1,{msg:A.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:x,onChange:q=>w(q.target.value),placeholder:"Optional",style:g1}),i.jsx(m1,{msg:A.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:q=>j(q.target.value),style:{...g1,cursor:"pointer"},children:[i.jsx("option",{value:"active",children:"Active"}),i.jsx("option",{value:"inactive",children:"Inactive"})]}),i.jsx(m1,{msg:N.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:()=>M(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($,{})})]})]},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($,{})]})]})]})}const ma="__unassigned__",zp="__new__",Cje=["Presentation","Panel","Keynote","Workshop","Qna","Demo","Debate","Symposium","Other"],Eje=["Scheduled","Live","Completed","Cancelled"],Aje={Presentation:"panel",Panel:"panel",Keynote:"keynote",Workshop:"workshop",Qna:"networking",Demo:"breakout",Debate:"panel",Symposium:"workshop",Other:"breakout"},Tje={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},Pje={Scheduled:"scheduled",Live:"ongoing",Completed:"completed",Cancelled:"cancelled"},Ije={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function sm(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 Oje(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:sm(o.toISOString()),end:sm(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:sm(r.toISOString()),end:sm(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 xf({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 Nje({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(bi,{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 Rje(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 sB(e,t){if(!e)return"";const r=e[t];return r==null||r===""?"":String(r)}function Lje({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=S.useMemo(()=>Oje(r),[r]),h=S.useMemo(()=>{if(!(s!=null&&s.track))return ma;const Mt=s.track;return typeof Mt=="object"&&Mt&&"_id"in Mt?String(Mt._id):String(Mt)},[s]),[p,v]=S.useState(1),[m,b]=S.useState(()=>d?new Set([1,2,3,4]):new Set),[x,w]=S.useState(!1),[k,j]=S.useState(null),[_,T]=S.useState(()=>d?h:a===ma?ma:a&&a!==ma?a:o.length?o[0]._id:zp),[A,P]=S.useState(""),[N,O]=S.useState(""),[C,I]=S.useState("general"),[R,F]=S.useState(!1),[M,Y]=S.useState({}),[X,$]=S.useState((s==null?void 0:s.title)||""),[ee,V]=S.useState((s==null?void 0:s.type)&&Tje[s.type]||"Presentation"),[D,z]=S.useState((s==null?void 0:s.status)&&Ije[s.status]||"Scheduled"),[q,G]=S.useState(s!=null&&s.startTime?sm(s.startTime):f.start),[U,Q]=S.useState(s!=null&&s.endTime?sm(s.endTime):f.end),[K,re]=S.useState((s==null?void 0:s.description)||""),H=Mt=>Mt!==!1,[ie,de]=S.useState(()=>s?H(s.audienceFeedbackEnabled):!0),[le,ke]=S.useState(()=>s?H(s.audienceRatingsEnabled):!0),[ve,se]=S.useState(()=>s?H(s.audienceKeyPersonsEnabled):!0),[be,De]=S.useState(()=>s?H(s.audienceMySessionsEnabled):!0),[ae,ue]=S.useState(()=>s?H(s.audienceAgendaEnabled):!0),[Me,Se]=S.useState(()=>sB(s??null,"audienceFeedbackForm")),[Pe,Ee]=S.useState(()=>sB(s??null,"audienceRatingsForm")),[Ae,Ye]=S.useState([]),[rt,He]=S.useState(!1),[xt,st]=S.useState([]),[Te,et]=S.useState(!0),[Pt,qe]=S.useState(()=>Rje(s)),[Et,vt]=S.useState(""),[Ft,Ce]=S.useState(!1),[lt,Xe]=S.useState(""),[Be,ct]=S.useState(""),[Tt,We]=S.useState(""),[ce,he]=S.useState(""),[je,xe]=S.useState(""),[Re,ze]=S.useState({}),[Le,Qe]=S.useState(!1);S.useEffect(()=>{let Mt=!1;return(async()=>{var yo;et(!0);const xr={limit:500};n&&(xr.organization=n);const $n=await Lf.list(xr);!Mt&&((yo=$n.data)!=null&&yo.speakers)&&st($n.data.speakers),Mt||et(!1)})(),()=>{Mt=!0}},[n]),S.useEffect(()=>{const Mt=n==null?void 0:n.trim();if(!Mt){Ye([]);return}let xr=!1;return He(!0),Mo.list({organization:Mt}).then($n=>{xr||Ye($n.filter(yo=>yo.type==="feedback"&&!["Give us your feedback","Rate us","EventBuzz Default Feedback","EventBuzz Default Ratings"].includes(yo.name??"")))}).catch(()=>{xr||Ye([])}).finally(()=>{xr||He(!1)}),()=>{xr=!0}},[n]);const mt=S.useCallback(Mt=>{const xr=xt.find($n=>$n._id===Mt);return xr?`${xr.firstName} ${xr.lastName}`.trim():`Speaker…${Mt.slice(-6)}`},[xt]),ft=Mt=>{!Mt||Pt.includes(Mt)||qe(xr=>[...xr,Mt])},It=Mt=>qe(xr=>xr.filter($n=>$n!==Mt)),Bt=async()=>{const Mt={};if(lt.trim()||(Mt.firstName="First name is required."),Be.trim()||(Mt.lastName="Last name is required."),Tt.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Tt.trim())||(Mt.email="Enter a valid email."):Mt.email="Email is required.",ze(Mt),Object.keys(Mt).length)return;Qe(!0);const xr=await Lf.create({firstName:lt.trim(),lastName:Be.trim(),email:Tt.trim().toLowerCase(),phone:ce.trim()||void 0,title:je.trim()||void 0,...n?{organization:n}:{}});if(Qe(!1),xr.error||!xr.data){ze({email:xr.error||"Could not create speaker"});return}const $n=xr.data;st(yo=>[$n,...yo.filter(Wt=>Wt._id!==$n._id)]),ft($n._id),Xe(""),ct(""),We(""),he(""),xe(""),ze({}),Ce(!1)},[dr,pr]=S.useState({}),[an,Jn]=S.useState({}),[Fi,Fn]=S.useState({}),[Bo,io]=S.useState({}),Wo=S.useCallback(()=>{const Mt={};return _===zp?Mt.track='Choose "Add new track" and fill the form below, or pick an existing track.':_||(Mt.track="Select a track."),pr(Mt),Object.keys(Mt).length===0},[_]),Yi=S.useCallback(()=>{const Mt={};return X.trim()||(Mt.title="Session title is required."),Jn(Mt),Object.keys(Mt).length===0},[X]),qo=S.useCallback(()=>{const Mt={};q||(Mt.start="Start date and time required."),U||(Mt.end="End date and time required.");const xr=new Date(q).getTime(),$n=new Date(U).getTime();return q&&U&&!($n>xr)&&(Mt.end="End must be after start."),Fn(Mt),Object.keys(Mt).length===0},[q,U]),Ca=S.useCallback(()=>(io({}),!0),[]),xs=S.useCallback(()=>Wo()&&Yi()&&qo()&&Ca(),[Wo,Yi,qo,Ca]),el=async()=>{const Mt={};if(A.trim()||(Mt.name="Track name is required."),Y(Mt),Object.keys(Mt).length)return;F(!0);const xr=await dm.create(e,{name:A.trim(),hall:N.trim()||void 0,trackType:C,status:"active"});if(F(!1),xr.error||!xr.data){Y({name:xr.error||"Could not create track"});return}const $n=xr.data;u($n),T($n._id),P(""),O(""),Y({})},op=Mt=>{Mt===1&&!Wo()||Mt===2&&!Yi()||Mt===3&&!qo()||Mt===4&&!Ca()||(b(xr=>new Set([...xr,Mt])),Mt<4&&v(Mt+1))},jn=async()=>{if(j(null),_===zp){v(1),Wo();return}if(!xs()){Wo()?Yi()?qo()?v(4):v(3):v(2):v(1);return}const Mt={title:X.trim(),description:K.trim()||void 0,type:Aje[ee],startTime:new Date(q).toISOString(),endTime:new Date(U).toISOString(),status:Pje[D],track:_===ma?null:_,speakers:Pt,audienceFeedbackEnabled:ie,audienceRatingsEnabled:le,audienceKeyPersonsEnabled:ve,audienceMySessionsEnabled:be,audienceAgendaEnabled:ae,audienceFeedbackForm:ie&&Me.trim()||null,audienceRatingsForm:le&&Pe.trim()||null};w(!0);const xr=d?await ta.update(s._id,Mt):await ta.create(e,Mt);if(w(!1),xr.error){j(xr.error);return}c(),l()},Ld=[{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."}],tl=()=>i.jsx("button",{type:"button",disabled:x,onClick:jn,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:x?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:x?.85:1},children:x?"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(Gt,{size:14})}),i.jsx(tl,{})]})]}),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:Ld.map(Mt=>{const xr=p===Mt.n,$n=m.has(Mt.n),yo=xr?"active":$n?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>v(xr?0:Mt.n),style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Nje,{n:Mt.n,state:yo}),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:xr?"var(--primary)":"var(--card-foreground)",margin:0},children:Mt.title}),!xr&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:Mt.subtitle})]}),xr?i.jsx(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{size:18,style:{color:"var(--muted)"}})]}),xr&&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:Mt.subtitle}),Mt.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:_===zp?zp:_,onChange:Wt=>{const zn=Wt.target.value;T(zn),pr({})},style:{...To,cursor:"pointer"},children:[i.jsx("option",{value:ma,children:"Unassigned"}),o.map(Wt=>i.jsxs("option",{value:Wt._id,children:[Wt.name,Wt.hall?` · ${Wt.hall}`:""]},Wt._id)),i.jsx("option",{value:zp,children:"+ Add new track"})]}),i.jsx(xf,{msg:dr.track})]}),_===zp&&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:A,onChange:Wt=>{P(Wt.target.value),M.name&&Y({})},placeholder:"Track name",style:To}),i.jsx(xf,{msg:M.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:C,onChange:Wt=>I(Wt.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:N,onChange:Wt=>O(Wt.target.value),placeholder:"Optional",style:To})]}),i.jsxs("button",{type:"button",disabled:R,onClick:el,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:R?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(gr,{size:14})," ",R?"Creating…":"Create track & select"]})]})]}),Mt.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:X,onChange:Wt=>{$(Wt.target.value),an.title&&Jn({})},placeholder:"Session title",style:To}),i.jsx(xf,{msg:an.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:Wt=>V(Wt.target.value),style:{...To,cursor:"pointer"},children:Cje.map(Wt=>i.jsx("option",{value:Wt,children:Wt},Wt))})]}),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:D,onChange:Wt=>z(Wt.target.value),style:{...To,cursor:"pointer"},children:Eje.map(Wt=>i.jsx("option",{value:Wt,children:Wt},Wt))})]})]})]}),Mt.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(Pf,{value:q,onChange:Wt=>{G(Wt),Fi.start&&Fn({})},style:To,hasError:!!Fi.start,disabled:x}),i.jsx(xf,{msg:Fi.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(Pf,{value:U,onChange:Wt=>{Q(Wt),Fi.end&&Fn({})},style:To,hasError:!!Fi.end,disabled:x}),i.jsx(xf,{msg:Fi.end})]})]}),Mt.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."}),Pt.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"10px"},children:Pt.map(Wt=>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:[mt(Wt),i.jsx("button",{type:"button",onClick:()=>It(Wt),style:{display:"flex",padding:0,border:"none",background:"none",cursor:"pointer",color:"var(--muted)"},"aria-label":"Remove",children:i.jsx(Gt,{size:12})})]},Wt))}),Te?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:Et,onChange:Wt=>vt(Wt.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 Wt=xt.filter(Gr=>!Pt.includes(Gr._id)),zn=Et.trim().toLowerCase(),gu=Wt.filter(Gr=>zn?`${Gr.firstName} ${Gr.lastName}`.toLowerCase().includes(zn)||(Gr.email||"").toLowerCase().includes(zn):!0);return xt.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."}):Wt.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."}):gu.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."}):gu.slice(0,80).map(Gr=>i.jsxs("button",{type:"button",onClick:()=>ft(Gr._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:rl=>{rl.currentTarget.style.background="var(--secondary)"},onMouseLeave:rl=>{rl.currentTarget.style.background="transparent"},children:[i.jsxs("span",{style:{fontWeight:"var(--font-weight-medium)"},children:[Gr.firstName," ",Gr.lastName]}),Gr.title&&i.jsx("span",{style:{color:"var(--muted)",fontSize:"var(--text-xs)",marginLeft:"6px"},children:Gr.title}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)"},children:Gr.email})]},Gr._id))})()})]}),i.jsxs("button",{type:"button",onClick:()=>{Ce(Wt=>!Wt),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(yT,{size:14})," ",Ft?"Hide new speaker form":"Add new speaker"]}),Ft&&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:lt,onChange:Wt=>{Xe(Wt.target.value),Re.firstName&&ze({})},style:To}),i.jsx(xf,{msg:Re.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:Be,onChange:Wt=>{ct(Wt.target.value),Re.lastName&&ze({})},style:To}),i.jsx(xf,{msg:Re.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:Tt,onChange:Wt=>{We(Wt.target.value),Re.email&&ze({})},style:To}),i.jsx(xf,{msg:Re.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:ce,onChange:Wt=>he(Wt.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:je,onChange:Wt=>xe(Wt.target.value),placeholder:"e.g. Prof. of Medicine",style:To})]})]}),i.jsxs("button",{type:"button",disabled:Le,onClick:Bt,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:Le?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," ",Le?"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:K,onChange:Wt=>re(Wt.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 what appears on this session's mobile page for attendees."}),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:ve,onChange:Wt=>se(Wt.target.checked),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:"Key Persons"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show speakers and moderators for this session."})]})]}),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:be,onChange:Wt=>De(Wt.target.checked),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:"My Sessions"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show bookmarked sessions for this event."})]})]}),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:Wt=>ue(Wt.target.checked),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:"Agenda"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show the full event agenda schedule."})]})]}),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:ie,onChange:Wt=>{const zn=Wt.target.checked;de(zn),zn||Se("")},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."})]})]}),ie?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:Me,onChange:Wt=>Se(Wt.target.value),disabled:rt,style:{...To,cursor:rt?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),Ae.map(Wt=>i.jsx("option",{value:Wt._id,children:Wt.name},Wt._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:le,onChange:Wt=>{const zn=Wt.target.checked;ke(zn),zn||Ee("")},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."})]})]}),le?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:Pe,onChange:Wt=>Ee(Wt.target.value),disabled:rt,style:{...To,cursor:rt?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),Ae.map(Wt=>i.jsx("option",{value:Wt._id,children:Wt.name},Wt._id))]})]}):null]})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:Mt.n<4?i.jsx("button",{type:"button",onClick:()=>op(Mt.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(tl,{})})]})]},Mt.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(tl,{})]})]})]})}const Fje={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},zje={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function Mje(e){return{general:"General",workshop:"Workshop",plenary:"Plenary",symposium:"Symposium"}[e]||"General"}function Dje(e){if(e&&typeof e=="object"&&"firstName"in e){const t=e;return`${t.firstName||""} ${t.lastName||""}`.trim()}return""}function Bje(e){var r,n;if((r=e.speakers)!=null&&r.length){const o=e.speakers.map(Dje).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 Wje(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:Fje[e.type]||"Other",startDate:o.date,startTime:o.time,endDate:a.date,endTime:a.time,status:zje[e.status]||"Scheduled",speaker:Bje(e),description:e.description}}const p6={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"}},qje={Scheduled:{bg:"#e0e7ff",color:"#3730a3"},Live:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"#f1f5f9",color:"#475569"},Cancelled:{bg:"#fee2e2",color:"#b91c1c"}};function IG({type:e}){const t=p6[e]||p6.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 OG({status:e}){const t=qje[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 lc={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 $je({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f;const[s,l]=S.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(wv,{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(Om,{size:10})," ",e.speaker]})]}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsx(IG,{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(rS,{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(OG,{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(wi,{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:{...lc,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(Zf,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:h=>{h.stopPropagation(),n()},style:{...lc,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(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:h=>{h.stopPropagation(),r()},style:{...lc,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(Xr,{size:13})})]})})]})}function Uje({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f,h;const[s,l]=S.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=p6[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(IG,{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(Om,{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(rS,{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(OG,{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:{...lc,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(wi,{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:{...lc,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 v;(v=e.joinCode)!=null&&v.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(Zf,{size:11})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:n,style:{...lc,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(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:r,style:{...lc,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(Xr,{size:13})})]})]})]})]})}function Hje({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(Wh,{size:16,style:{color:"var(--destructive)"}}):i.jsx(Js,{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 Vje({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:v}){var k,j,_,T;const b=Si()==="mobile",[x,w]=S.useState(b?"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:b?"0 12px":"0 16px",background:"var(--card)",borderBottom:t?"1px solid var(--border)":"none",minHeight:b?"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(go,{size:13}):i.jsx(ka,{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}),!b&&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}),!b&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"3px",flexShrink:0},children:[i.jsx(Ab,{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}),!b&&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:A=>{A.stopPropagation(),u()},style:{display:"flex",alignItems:"center",gap:"5px",padding:b?"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(gr,{size:12}),!b&&" Add Session"]}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",title:"Edit track",onClick:A=>{A.stopPropagation(),o()},style:{...lc},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(--card-foreground)"},children:i.jsx(wi,{size:13})}),i.jsx("button",{type:"button",title:(k=e.joinCode)!=null&&k.trim()?"QR code":"Join code not available yet",disabled:!((j=e.joinCode)!=null&&j.trim()),onClick:A=>{A.stopPropagation(),l()},style:{...lc,opacity:(_=e.joinCode)!=null&&_.trim()?1:.35,cursor:(T=e.joinCode)!=null&&T.trim()?"pointer":"not-allowed"},onMouseEnter:A=>{var P;(P=e.joinCode)!=null&&P.trim()&&(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(--card-foreground)"},children:i.jsx(Zf,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate track",disabled:c,onClick:A=>{A.stopPropagation(),s()},style:{...lc,opacity:c?.7:1,cursor:c?"wait":"pointer"},onMouseEnter:A=>{c||(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(--card-foreground)"},children:c?i.jsx(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete track",onClick:A=>{A.stopPropagation(),a()},style:{...lc,color:"var(--destructive)"},onMouseEnter:A=>{A.currentTarget.style.background="#fef2f2",A.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:A=>{A.currentTarget.style.background="var(--card)",A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--destructive)"},children:i.jsx(Xr,{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(A=>i.jsxs("button",{onClick:()=>w(A),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",background:x===A?"var(--primary)":"transparent",color:x===A?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:A==="card"?"1px solid var(--border)":"none"},children:[A==="list"?i.jsx(Eb,{size:13}):i.jsx(Cb,{size:13}),A==="list"?"List":"Cards"]},A))})]}),e.sessions.length===0?i.jsxs("div",{style:{padding:"36px 16px",textAlign:"center"},children:[i.jsx(Vi,{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(gr,{size:13})," Add First Session"]})]}):x==="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(A=>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:A},A))]})}),i.jsx("tbody",{children:e.sessions.map(A=>i.jsx($je,{session:A,onEdit:()=>d(A),onDelete:()=>f(A.id),onDuplicate:()=>h(A),onOpenQr:()=>p(A),duplicateLoading:v===A.id},A.id))})]})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px",padding:"14px 16px"},children:e.sessions.map(A=>i.jsx(Uje,{session:A,onEdit:()=>d(A),onDelete:()=>f(A.id),onDuplicate:()=>h(A),onOpenQr:()=>p(A),duplicateLoading:v===A.id},A.id))})]})]})}function lB({embedInDashboard:e=!1}={}){const{selectedEventId:t,openAgendaSessionPanelOnce:r,setOpenAgendaSessionPanelOnce:n}=Li(),o=Si(),a=o==="mobile",s=o==="mobile"||o==="tablet",[l,c]=S.useState(""),[u,d]=S.useState(new Date().toISOString()),[f,h]=S.useState(""),[p,v]=S.useState([]),[m,b]=S.useState({}),[x,w]=S.useState([]),[k,j]=S.useState(new Set),[_,T]=S.useState(!1),[A,P]=S.useState(null),[N,O]=S.useState(null),[C,I]=S.useState(null),[R,F]=S.useState(null),[M,Y]=S.useState(null),[X,$]=S.useState(null),[ee,V]=S.useState(null);S.useEffect(()=>{!t||!r||(O({initialTrackId:ma}),n(!1))},[t,r,n]);const D=S.useCallback(async()=>{var Ae,Ye;if(!t)return;T(!0),P(null);const[le,ke,ve]=await Promise.all([Lr.get(t),dm.list(t),ta.list(t)]);if(T(!1),le.error||!le.data){P(le.error||"Could not load event");return}const se=le.data;c(se.name||"Event"),d(se.startDate||new Date().toISOString());const be=typeof se.organization=="object"&&se.organization&&"_id"in se.organization?String(se.organization._id):se.organization?String(se.organization):"";h(be);const De=((Ae=ke.data)==null?void 0:Ae.tracks)||[];v(De);const ae=((Ye=ve.data)==null?void 0:Ye.sessions)||[],ue={};ae.forEach(rt=>{ue[rt._id]=rt}),b(ue);const Me=[...De].sort((rt,He)=>(rt.sortOrder??0)-(He.sortOrder??0)||rt.name.localeCompare(He.name)),Se=new Map;Me.forEach(rt=>{Se.set(rt._id,{id:rt._id,joinCode:rt.joinCode,name:rt.name,type:Mje(rt.trackType),hall:rt.hall||"—",status:rt.status==="active"?"Active":"Inactive",sessions:[]})});const Pe={id:ma,name:"Unassigned",type:"General",hall:"—",status:"Active",sessions:[]};ae.forEach(rt=>{const He=Wje(rt),xt=typeof rt.track=="object"&&rt.track&&"_id"in rt.track?String(rt.track._id):rt.track?String(rt.track):"";xt&&Se.has(xt)?Se.get(xt).sessions.push(He):Pe.sessions.push(He)});const Ee=[...Se.values()];Pe.sessions.sort((rt,He)=>rt.startDate.localeCompare(He.startDate)||rt.startTime.localeCompare(He.startTime)),Ee.forEach(rt=>{rt.sessions.sort((He,xt)=>He.startDate.localeCompare(xt.startDate)||He.startTime.localeCompare(xt.startTime))}),Pe.sessions.length&&Ee.push(Pe),w(Ee),j(rt=>rt.size===0&&Ee.length?new Set([Ee[0].id]):rt)},[t]);S.useEffect(()=>{D()},[D]);const z=le=>j(ke=>{const ve=new Set(ke);return ve.has(le)?ve.delete(le):ve.add(le),ve}),q=()=>I({editTrack:null}),G=le=>{if(le.id===ma)return;const ke=p.find(ve=>ve._id===le.id);ke&&I({editTrack:ke})},U=le=>{if(le===ma)return;const ke=x.find(ve=>ve.id===le);F({title:"Confirm Delete",msg:`Delete "${ke==null?void 0:ke.name}"? Sessions in this track become unassigned.`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const ve=await dm.remove(le);F(null),ve.error||await D()}})},Q=async le=>{if(le.id===ma||!t)return;const ke=p.find(be=>be._id===le.id);if(!ke)return;const ve=await dm.create(t,{name:`${ke.name} (Copy)`,hall:ke.hall,trackType:ke.trackType,status:"active",sortOrder:(ke.sortOrder??0)+1});if(ve.error||!ve.data)return;const se=ve.data;for(const be of le.sessions){const De=m[be.id];if(!De)continue;typeof De.track=="object"&&De.track&&"_id"in De.track?String(De.track._id):De.track&&String(De.track);const ae=(De.speakers||[]).map(ue=>typeof ue=="object"&&ue&&"_id"in ue?String(ue._id):String(ue));await ta.create(t,{title:`${De.title} (Copy)`,description:De.description,type:De.type,startTime:De.startTime,endTime:De.endTime,location:De.location,status:De.status,track:se._id,speakers:ae.filter(Boolean)})}await D()},K=le=>{le.id===ma||!t||F({title:"Duplicate track",msg:`Create a copy of "${le.name}" including all ${le.sessions.length} session(s)? This may take a moment.`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{F(null),$(le.id);try{await Q(le)}finally{$(null)}}})},re=(le,ke)=>{const ve=m[ke];F({title:"Confirm Delete",msg:`Delete "${(ve==null?void 0:ve.title)||"session"}"?`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const se=await ta.remove(ke);F(null),se.error||await D()}})},H=async(le,ke)=>{if(!t)return;const ve=m[ke.id];if(!ve)return;const se=typeof ve.track=="object"&&ve.track&&"_id"in ve.track?ve.track._id:ve.track||null,be=(ve.speakers||[]).map(De=>typeof De=="object"&&De&&"_id"in De?String(De._id):String(De));await ta.create(t,{title:`${ve.title} (Copy)`,description:ve.description,type:ve.type,startTime:ve.startTime,endTime:ve.endTime,location:ve.location,status:ve.status,track:se?String(se):null,speakers:be.filter(Boolean),audienceFeedbackEnabled:ve.audienceFeedbackEnabled,audienceRatingsEnabled:ve.audienceRatingsEnabled,audienceKeyPersonsEnabled:ve.audienceKeyPersonsEnabled,audienceMySessionsEnabled:ve.audienceMySessionsEnabled,audienceAgendaEnabled:ve.audienceAgendaEnabled,audienceFeedbackForm:ve.audienceFeedbackForm??null,audienceRatingsForm:ve.audienceRatingsForm??null}),await D()},ie=(le,ke)=>{F({title:"Duplicate session",msg:`Create a copy of "${ke.title}"?`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{F(null),V(ke.id);try{await H(le,ke)}finally{V(null)}}})},de=x.reduce((le,ke)=>le+ke.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":"Event Home"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:A?i.jsx("span",{style:{color:"var(--destructive)"},children:A}):`${x.filter(le=>le.id!==ma).length} tracks · ${de} sessions`})]}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:i.jsxs("button",{onClick:q,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:le=>{le.currentTarget.style.borderColor="var(--primary)",le.currentTarget.style.color="var(--primary)"},onMouseLeave:le=>{le.currentTarget.style.borderColor="var(--border)",le.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(gr,{size:14})," ",s?"Track":"Add Track"]})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("button",{onClick:()=>j(new Set(x.map(le=>le.id))),style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"none",border:"none",cursor:"pointer",padding:"0 4px"},onMouseEnter:le=>{le.currentTarget.style.color="var(--foreground)"},onMouseLeave:le=>{le.currentTarget.style.color="var(--muted)"},children:"Expand all"}),i.jsx("span",{style:{color:"var(--border)"},children:"·"}),i.jsx("button",{onClick:()=>j(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:le=>{le.currentTarget.style.color="var(--foreground)"},onMouseLeave:le=>{le.currentTarget.style.color="var(--muted)"},children:"Collapse all"})]}),x.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 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:q,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(gr,{size:14})," Add First Track"]})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:x.map(le=>i.jsx(Vje,{track:le,virtual:le.id===ma,isOpen:k.has(le.id),onToggle:()=>z(le.id),onEdit:()=>G(le),onDelete:()=>U(le.id),onDuplicate:()=>K(le),onOpenTrackQr:()=>Y({kind:"track",label:le.name,joinCode:le.joinCode||""}),duplicateTrackLoading:X===le.id,onAddSession:()=>O({initialTrackId:le.id===ma?ma:le.id}),onEditSession:ke=>O({initialTrackId:le.id,sessionId:ke.id}),onDeleteSession:ke=>re(le.id,ke),onDuplicateSession:ke=>ie(le.id,ke),onOpenSessionQr:ke=>Y({kind:"session",label:ke.title,joinCode:ke.joinCode||""}),duplicatingSessionId:ee},le.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"})}),N&&t&&i.jsx(Lje,{eventId:t,eventName:l,eventStartIso:u,organizationId:f,tracks:p,initialTrackId:N.initialTrackId??void 0,session:N.sessionId?m[N.sessionId]??null:null,onClose:()=>O(null),onSuccess:()=>D(),onTrackCreated:le=>v(ke=>[...ke,le])}),C&&t&&i.jsx(_je,{eventId:t,existingTrack:C.editTrack,onClose:()=>I(null),onSuccess:()=>D()}),R&&i.jsx(Hje,{title:R.title,message:R.msg,confirmLabel:R.confirmLabel,variant:R.variant,onConfirm:R.onConfirm,onCancel:()=>F(null)}),M&&i.jsx(FT,{open:!0,onClose:()=>Y(null),kind:M.kind,joinCode:M.joinCode,label:M.label})]}):i.jsxs("div",{style:{textAlign:"center",padding:"80px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Vi,{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 Mp={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 Dp({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 v1({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 Bp({children:e}){return i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e})}function cB({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function Yje({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(bi,{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 sE({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(Yje,{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(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{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 Gje={firstName:"",lastName:"",email:"",phone:"",organization:"",designation:"",notes:""},Kje=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function uB(e){const t={};e.firstName.trim()||(t.firstName="First name is required."),e.lastName.trim()||(t.lastName="Last name is required."),e.email.trim()?Kje.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 dB(e){return{}}function Qje({eventId:e,onClose:t,participantId:r,onSuccess:n}){const o=!!r,a=3,[s,l]=S.useState(1),[c,u]=S.useState(()=>o?new Set([1,2,3]):new Set),[d,f]=S.useState(Gje),[h,p]=S.useState(!1),[v,m]=S.useState({}),[b,x]=S.useState(null);S.useEffect(()=>{r&&ai.get(r).then(N=>{const O=N.data;O&&(f({firstName:O.firstName??"",lastName:O.lastName??"",email:O.email??"",phone:O.phone??"",organization:O.organization??"",designation:O.designation??"",notes:O.notes??""}),u(new Set([1,2,3])))})},[r]);const w=S.useCallback((N,O)=>{f(C=>({...C,[N]:O})),m(C=>{if(!C[N])return C;const I={...C};return delete I[N],I}),x(null)},[]),k=S.useCallback(()=>{const N=uB(d),O=dB(),C={...N,...O};return m(C),Object.keys(N).length?{ok:!1,section:1}:Object.keys(O).length?{ok:!1,section:2}:{ok:!0,section:0}},[d]),j=N=>{if(N===1){const O=uB(d);if(m(C=>({...C,...O})),Object.keys(O).length)return;u(C=>new Set([...C,1])),l(2);return}if(N===2){const O=dB();if(m(C=>({...C,...O})),Object.keys(O).length)return;u(C=>new Set([...C,2])),l(3);return}N===3&&_()},_=async()=>{const N=k();if(!N.ok){l(N.section);return}p(!0),x(null);const O={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},C=o&&r?await ai.update(r,O):await ai.create(e,O);if(p(!1),C.error){x(C.error),/email|duplicate|exists/i.test(C.error)&&m(I=>({...I,email:C.error||"This email may already be registered for this event."}));return}n==null||n(),t()},T=N=>l(O=>O===N?0:N),A=!h,P=({compact:N})=>i.jsx("button",{type:"button",disabled:!A,onClick:_,style:{padding:N?"6px 16px":"7px 18px",borderRadius:"var(--radius-button)",background:A?"var(--primary)":"var(--secondary)",color:A?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:A?"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(Gt,{size:14})}),i.jsx(P,{compact:!0})]})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginBottom:"8px",fontFamily:"var(--font-noto-sans)"},children:b}),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(sE,{n:1,title:"Personal information",subtitle:"Name and contact details",open:s===1,completed:c.has(1),onToggle:()=>T(1),onNext:()=>j(1),nextLabel:"Next: Professional details",children:i.jsxs(cB,{cols:2,children:[i.jsxs(Bp,{children:[i.jsx(Dp,{text:"First name",required:!0}),i.jsx("input",{style:Mp,placeholder:"John",value:d.firstName,onChange:N=>w("firstName",N.target.value)}),i.jsx(v1,{msg:v.firstName})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Last name",required:!0}),i.jsx("input",{style:Mp,placeholder:"Smith",value:d.lastName,onChange:N=>w("lastName",N.target.value)}),i.jsx(v1,{msg:v.lastName})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Email",required:!0}),i.jsx("input",{type:"email",style:Mp,placeholder:"john@example.com",value:d.email,onChange:N=>w("email",N.target.value)}),i.jsx(v1,{msg:v.email})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Phone"}),i.jsx("input",{type:"tel",style:Mp,placeholder:"+91 9800000000",value:d.phone,onChange:N=>w("phone",N.target.value)}),i.jsx(v1,{msg:v.phone})]})]})}),i.jsx(sE,{n:2,title:"Professional details",subtitle:"Organization and designation",open:s===2,completed:c.has(2),onToggle:()=>T(2),onNext:()=>j(2),nextLabel:"Next: Additional info",children:i.jsxs(cB,{cols:2,children:[i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Organization"}),i.jsx("input",{style:Mp,placeholder:"Company or institution",value:d.organization,onChange:N=>w("organization",N.target.value)})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Designation"}),i.jsx("input",{style:Mp,placeholder:"e.g. Delegate, Speaker",value:d.designation,onChange:N=>w("designation",N.target.value)})]})]})}),i.jsx(sE,{n:3,title:"Additional info",subtitle:"Internal notes (optional)",open:s===3,completed:c.has(3),onToggle:()=>T(3),onNext:()=>j(3),nextLabel:"Save participant",nextDisabled:h,children:i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Notes"}),i.jsx("textarea",{style:{...Mp,resize:"vertical",minHeight:"80px"},placeholder:"Internal notes (optional)",value:d.notes,onChange:N=>w("notes",N.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(P,{})]})]})]})}const NG=["Status","Tag","Event"],Xje=["is","is not"],RG=[{label:"Pending",value:"pending"},{label:"Confirmed",value:"confirmed"},{label:"Checked In",value:"checked_in"},{label:"Cancelled",value:"cancelled"}],fB=()=>({listName:"",description:"",rules:[{id:`r-${Math.random().toString(36).slice(2)}`,field:"Status",operator:"is",value:"pending"}],conjunction:"AND",visibility:"Private",autoUpdate:"Yes"});function LG(e){return`rule-${e}-${Math.random().toString(36).slice(2,10)}`}function Zje(e,t){const r=String(e.field??"Status"),n=NG.includes(r)?r:"Status",a=String(e.operator??"is").trim().toLowerCase()==="is not"?"is not":"is";let s=String(e.value??"");return n==="Status"&&(RG.some(c=>c.value===s)||(s="pending")),{id:LG(t),field:n,operator:a,value:s}}function lE(e){const t=e.rules,r=Array.isArray(t==null?void 0:t.rules)?t.rules:[],n=r.length?r.map((o,a)=>Zje(o,a)):[{id:LG(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 YP({onClose:e,onCreated:t,onSaved:r,editList:n=null}){const{user:o}=Mr(),a=Nn(o),s=3,l=wc(s),c=(n==null?void 0:n.type)==="rule_based",[u,d]=S.useState(()=>c&&n?lE(n):fB()),f=(R,F)=>d(M=>({...M,[R]:F})),[h,p]=S.useState([]),[v,m]=S.useState([]),[b,x]=S.useState(!0),[w,k]=S.useState(!1),[j,_]=S.useState(null);S.useEffect(()=>{let R=!1;if(!a){x(!1);return}return x(!0),Promise.all([ai.listDistinctTags({organization:a}),Lr.list({limit:400,organization:a})]).then(([F,M])=>{var Y,X;R||((Y=F.data)!=null&&Y.tags&&p(F.data.tags),(X=M.data)!=null&&X.events&&m(M.data.events),x(!1))}).catch(()=>{R||x(!1)}),()=>{R=!0}},[a]),S.useEffect(()=>{if(!n||n.type!=="rule_based"){d(fB());return}d(lE(n));let R=!1;return qa.get(n._id).then(F=>{if(R||F.error||!F.data)return;const M=F.data;M.type==="rule_based"&&d(lE(M))}),()=>{R=!0}},[n==null?void 0:n._id]),S.useEffect(()=>{h.length&&d(R=>({...R,rules:R.rules.map(F=>F.field!=="Tag"||F.value&&h.includes(F.value)?F:{...F,value:h[0]})}))},[h]),S.useEffect(()=>{v.length&&d(R=>({...R,rules:R.rules.map(F=>F.field!=="Event"||F.value&&v.some(M=>M._id===F.value)?F:{...F,value:v[0]._id})}))},[v]);const T=()=>d(R=>({...R,rules:[...R.rules,{id:Math.random().toString(36).slice(2),field:"Status",operator:"is",value:"pending"}]})),A=R=>d(F=>({...F,rules:F.rules.filter(M=>M.id!==R)})),P=(R,F,M)=>d(Y=>({...Y,rules:Y.rules.map(X=>X.id===R?{...X,[F]:M}:X)})),N=(R,F)=>{let M="";F==="Status"?M="pending":F==="Tag"&&h[0]?M=h[0]:F==="Event"&&v[0]&&(M=v[0]._id),d(Y=>({...Y,rules:Y.rules.map(X=>X.id===R?{...X,field:F,operator:"is",value:M}:X)}))},O=R=>{if(R.field==="Status")return i.jsx("select",{style:Tr,value:R.value||"pending",onChange:F=>P(R.id,"value",F.target.value),onFocus:St,onBlur:jt,children:RG.map(F=>i.jsx("option",{value:F.value,children:F.label},F.value))});if(R.field==="Tag"){if(b)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 F=R.value&&h.includes(R.value)?R.value:h[0];return i.jsx("select",{style:Tr,value:F,onChange:M=>P(R.id,"value",M.target.value),onFocus:St,onBlur:jt,children:h.map(M=>i.jsx("option",{value:M,children:M},M))})}if(R.field==="Event"){if(b)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading events…"});if(v.length===0)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No events available."});const F=R.value&&v.some(M=>M._id===R.value)?R.value:v[0]._id;return i.jsx("select",{style:Tr,value:F,onChange:M=>P(R.id,"value",M.target.value),onFocus:St,onBlur:jt,children:v.map(M=>i.jsx("option",{value:M._id,children:M.name},M._id))})}return null},C=async()=>{if(_(null),!u.listName.trim()){_("List name is required.");return}if(u.rules.some(F=>F.field==="Tag"&&!h.length||F.field==="Event"&&!v.length)){_("Each rule needs a valid value. Add tags or events, or adjust rules.");return}k(!0);try{const F={rules:u.rules.map(({field:M,operator:Y,value:X})=>({field:M,operator:Y,value:X})),conjunction:u.conjunction};if(c&&n){const M=await qa.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:F});if(M.error){_(M.error||"Could not update list."),k(!1);return}M.data&&(r==null||r(M.data)),e()}else{const M=await qa.create({name:u.listName.trim(),description:u.description.trim(),visibility:u.visibility==="Shared"?"shared":"private",type:"rule_based",autoUpdate:u.autoUpdate==="Yes",rules:F});if(M.error){_(M.error||"Could not create list."),k(!1);return}t==null||t(),e()}}catch{_(c?"Could not update list.":"Could not create list.")}k(!1)},I=c?"Save changes":"Create List";return i.jsxs(ra,{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…":I,ctaDisabled:w,onCtaClick:C,children:[j&&i.jsx("p",{style:{margin:"0 20px 12px",fontSize:"var(--text-sm)",color:"var(--destructive)",fontFamily:"var(--font-noto-sans)"},children:j}),i.jsxs(Ur,{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(dt,{children:[i.jsx(ht,{text:"List Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. VIP Delegates — NAPCON 2026",value:u.listName,onChange:R=>f("listName",R.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe who this list is for…",value:u.description,onChange:R=>f("description",R.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(Ur,{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(R=>i.jsx("button",{type:"button",onClick:()=>f("conjunction",R),style:{padding:"4px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${u.conjunction===R?"var(--primary)":"var(--border)"}`,background:u.conjunction===R?"var(--accent)":"transparent",color:u.conjunction===R?"var(--primary)":"var(--muted)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:R},R)),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((R,F)=>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:[F>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:Tr,value:R.field,onChange:M=>N(R.id,M.target.value),onFocus:St,onBlur:jt,children:NG.map(M=>i.jsx("option",{value:M,children:M},M))})}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:R.operator,onChange:M=>P(R.id,"operator",M.target.value),onFocus:St,onBlur:jt,children:Xje.map(M=>i.jsx("option",{value:M,children:M},M))})}),i.jsx("div",{style:{position:"relative",minWidth:0},children:O(R)}),i.jsx("button",{type:"button",onClick:()=>A(R.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(Xr,{size:13})})]},R.id))}),i.jsxs("button",{type:"button",onClick:T,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(gr,{size:13})," Add Rule"]}),i.jsx(Vt,{text:"Status, Tag, and Event use lists from your organization. Tag options come from participant tags; Event from your events."})]}),i.jsx(Ur,{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 C(),nextLabel:I,nextDisabled:w,children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx(Hi,{name:"clVisibility",value:u.visibility,onChange:R=>f("visibility",R),options:[{label:"Private",value:"Private"},{label:"Shared",value:"Shared"}]}),i.jsx(Vt,{text:"Shared lists are visible to all admins."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Auto Update",required:!0}),i.jsx(Hi,{name:"clAutoUpdate",value:u.autoUpdate,onChange:R=>f("autoUpdate",R),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Recompute rule-based members when you open the list."})]})]})})]})}function Jje(e){return`eventbuzz:participant:${String(e||"").trim()}`}function e5e(e,t){return new Promise((r,n)=>{const o=new Image;o.onload=()=>{const a=o.naturalWidth,s=o.naturalHeight,l=28,c=20,u=14,d=22,f=11,h=document.createElement("canvas"),p=h.getContext("2d");if(!p){n(new Error("Canvas not supported"));return}p.font=`600 ${f}px ui-monospace, monospace`;const v=t.length>36?[t.slice(0,36),t.slice(36,72)]:[t],m=f+4,b=v.length*m+6,x=Math.max(...v.map(j=>p.measureText(j).width)),w=Math.ceil(Math.max(a+l*2,x+l*2)),k=c+s+u+b+d;h.width=w,h.height=k,p.fillStyle="#ffffff",p.fillRect(0,0,w,k),p.drawImage(o,(w-a)/2,c),p.fillStyle="#0f172a",p.font=`600 ${f}px ui-monospace, monospace`,p.textAlign="center",v.forEach((j,_)=>{p.fillText(j,w/2,c+s+u+_*m)});try{r(h.toDataURL("image/png"))}catch(j){n(j)}},o.onerror=()=>n(new Error("Failed to load QR image")),o.src=e})}function t5e({open:e,onClose:t,participantId:r,participantName:n}){const o=r?Jje(r):"",[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(!1);S.useEffect(()=>{if(!e){s(null),c(null),d(!1);return}if(!o){s(null),c(null);return}let m=!1;return c(null),_v.toDataURL(o,{width:256,margin:2,errorCorrectionLevel:"M",color:{dark:"#0f172a",light:"#ffffff"}}).then(b=>{m||s(b)}).catch(()=>{m||c("Could not generate QR code.")}),()=>{m=!0}},[e,o]);const p=()=>{o&&navigator.clipboard.writeText(o).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)})},v=async()=>{if(!a||f)return;h(!0);const m=n.replace(/[^\w\-]+/g,"_").slice(0,40)||"participant";try{const b=await e5e(a,o),x=document.createElement("a");x.href=b,x.download=`checkin-qr-${m}.png`,x.click()}catch{const b=document.createElement("a");b.href=a,b.download=`checkin-qr-${m}.png`,b.click()}finally{h(!1)}};return e?i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"participant-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:m=>m.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"16px"},children:[i.jsxs("div",{children:[i.jsx("h2",{id:"participant-qr-title",style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:"Check-in QR code"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.4},children:n}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"8px",lineHeight:1.45},children:["Scan with the ",i.jsx("strong",{children:"EventBuzz Checkins"})," app during an attendance session."]})]}),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(Gt,{size:16})})]}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"QR payload"}),i.jsx("input",{readOnly:!0,value:o,onFocus:m=>m.target.select(),style:{width:"100%",padding:"8px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"11px",fontFamily:"ui-monospace, monospace",color:"var(--foreground)"}})]}),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:l?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"16px"},children:l}):a?i.jsx("img",{src:a,alt:`Check-in QR for ${n}`,style:{width:200,height:200,display:"block"}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Generating…"})}),i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:p,disabled:!o,style:{flex:1,minWidth:"120px",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",padding:"8px 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:o?"pointer":"not-allowed"},children:[i.jsx(Js,{size:14}),u?"Copied":"Copy payload"]}),i.jsxs("button",{type:"button",onClick:()=>void v(),disabled:!a||f,style:{flex:1,minWidth:"120px",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",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:"var(--font-weight-medium)",cursor:a&&!f?"pointer":"not-allowed",opacity:a&&!f?1:.6},children:[i.jsx(ja,{size:14}),f?"Saving…":"Download PNG"]})]})]})}):null}function GP(e){const r={VIP:{bg:"#fef3c7",color:"#92400e"},Speaker:{bg:"var(--accent)",color:"var(--accent-foreground)"},Sponsor:{bg:"#dcfce7",color:"#15803d"},Press:{bg:"#f3e8ff",color:"#6b21a8"},Virtual:{bg:"#e0f2fe",color:"#075985"},Workshop:{bg:"#ffedd5",color:"#c2410c"}}[e];if(r)return r;let n=0;for(let a=0;at.trim()).filter(Boolean)}function FG(e,t=[]){const[r,n]=S.useState([]),[o,a]=S.useState(!1),s=S.useRef(null);return S.useEffect(()=>{a(!1)},t),S.useEffect(()=>{r.length===0&&a(!1)},[r.length]),S.useEffect(()=>{const d=s.current;if(!d||e.length===0)return;const f=e.filter(h=>r.includes(h)).length;d.indeterminate=f>0&&f0},[e,r]),{selectedIds:r,setSelectedIds:n,selectAllMatchingActive:o,setSelectAllMatchingActive:a,headerSelectRef:s,toggleRow:d=>{a(!1),n(f=>f.includes(d)?f.filter(h=>h!==d):[...f,d])},toggleAllVisible:()=>{a(!1),n(d=>{const f=new Set(d);return e.length>0&&e.every(p=>f.has(p))?e.forEach(p=>f.delete(p)):e.forEach(p=>f.add(p)),[...f]})},clearSelection:()=>{a(!1),n([])}}}function zG(e){const{selectedIds:t,listOrgId:r,eventId:n,onMessage:o,onClearSelection:a,onRefresh:s}=e,[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState([]),[k,j]=S.useState(()=>new Set),[_,T]=S.useState([]),[A,P]=S.useState("");return{bulkDialog:l,setBulkDialog:c,bulkBusy:u,tagBulkInput:f,setTagBulkInput:h,newListName:p,setNewListName:v,newListDesc:m,setNewListDesc:b,eventsPick:x,eventPickIds:k,toggleEventPick:X=>{j($=>{const ee=new Set($);return ee.has(X)?ee.delete(X):ee.add(X),ee})},fixedLists:_,addToListId:A,setAddToListId:P,openBulkDialog:async X=>{var $,ee;if(h(""),v(""),b(""),P(""),j(new Set),X==="assignEvents"){if(!r){o("Organisation required to load events.");return}const V=await Lr.list({limit:400,organization:r});($=V.data)!=null&&$.events&&w(V.data.events)}if(X==="addToList"){if(!r){o("Organisation required to load lists.");return}const D=(((ee=(await qa.list({organization:r})).data)==null?void 0:ee.lists)??[]).filter(z=>z.type==="fixed");T(D),D[0]&&P(D[0]._id)}c(X)},runBulkTags:async X=>{var V;const $=r5e(f);if(!$.length)return;d(!0);const ee=await ai.bulk({action:X,participantIds:t,tags:$});d(!1),ee.error?o(ee.error):(o(`${X==="add_tags"?"Added":"Removed"} tags for ${((V=ee.data)==null?void 0:V.updated)??0} participant(s).`),c(null),a(),s())},runBulkAssignEvents:async()=>{var ee;const X=[...k];if(!X.length)return;d(!0);const $=await ai.bulk({action:"assign_events",participantIds:t,eventIds:X});d(!1),$.error?o($.error):(o(`Assigned ${t.length} people to event(s). ${((ee=$.data)==null?void 0:ee.membershipsAdded)??0} new membership(s).`),c(null),a(),s())},runBulkNewList:async()=>{const X=p.trim();if(!X)return;d(!0);const $=await qa.create({name:X,description:m.trim(),type:"fixed",visibility:"private",autoUpdate:!1,participantIds:t});d(!1),$.error?o($.error):(o(`Custom list "${X}" created with ${t.length} member(s).`),c(null),a(),s())},runBulkAddToList:async()=>{var $;if(!A)return;d(!0);const X=await ai.bulk({action:"add_to_fixed_list",participantIds:t,listId:A});d(!1),X.error?o(X.error):(o(`Added ${(($=X.data)==null?void 0:$.updated)??0} people to the list.`),c(null),a(),s())},runBulkDelete:async()=>{var $;d(!0);const X=await ai.bulk({action:"delete",participantIds:t});d(!1),X.error?o(X.error):(o(`Deleted ${(($=X.data)==null?void 0:$.deleted)??0} participant(s).`),a(),s())},runBulkRemoveFromEvent:async()=>{var $;if(!n)return;d(!0);const X=await ai.bulk({action:"remove_from_event",participantIds:t,eventId:n});d(!1),X.error?o(X.error):(o(`Removed ${(($=X.data)==null?void 0:$.removed)??0} participant(s) from this event.`),a(),s())}}}function n5e({onOpenLists:e,onCreateList:t,isMobile:r=!1}){return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Custom lists"}),i.jsxs("button",{type:"button",onClick:t,style:{display:"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(gr,{size:13})," ",r?"New list":"Create Custom List"]})]})}function MG({tagOptions:e,activeTag:t,onChange:r}){return e.length===0?null:i.jsx("div",{style:{display:"flex",gap:"5px",flexWrap:"wrap",alignItems:"center"},children:e.map(n=>{const o=t===n,a=GP(n);return i.jsx("button",{type:"button",onClick:()=>r(o?null:n),style:{padding:"3px 10px",borderRadius:"999px",border:`1px solid ${o?a.color:"var(--border)"}`,background:o?a.bg:"var(--card)",color:o?a.color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",cursor:"pointer"},children:n},n)})})}function DG({total:e,loading:t,busy:r,checked:n,onChange:o}){return t||e<=0?null:i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"8px",flexShrink:0,cursor:r?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",userSelect:"none"},children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:a=>o(a.target.checked),style:{width:"16px",height:"16px",cursor:r?"wait":"pointer",accentColor:"var(--primary)"}}),i.jsxs("span",{children:["Select all matching filters (",e,")"]})]})}function BG({selectedCount:e,busy:t,variant:r,onAddTags:n,onRemoveTags:o,onAssignEvents:a,onNewList:s,onAddToList:l,onDeleteSelected:c,onRemoveFromEvent:u,onClearSelection:d}){if(e<=0)return null;const f={padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:t?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"};return i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",padding:"12px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:[e," selected"]}),i.jsx("button",{type:"button",disabled:t,onClick:n,style:f,children:"Add tags"}),i.jsx("button",{type:"button",disabled:t,onClick:o,style:f,children:"Remove tags"}),r==="portfolio"&&a?i.jsx("button",{type:"button",disabled:t,onClick:a,style:f,children:"Assign to event(s)"}):null,i.jsx("button",{type:"button",disabled:t,onClick:s,style:f,children:"New custom list"}),i.jsx("button",{type:"button",disabled:t,onClick:l,style:f,children:"Add to list"}),r==="portfolio"&&c?i.jsx("button",{type:"button",disabled:t,onClick:c,style:{...f,border:"1px solid var(--destructive)",background:"transparent",color:"var(--destructive)"},children:"Delete selected"}):null,r==="event"&&u?i.jsx("button",{type:"button",disabled:t,onClick:u,style:{...f,border:"1px solid var(--destructive)",background:"transparent",color:"var(--destructive)"},children:"Remove from event"}):null,i.jsx("button",{type:"button",onClick:d,style:{marginLeft:"auto",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"none",background:"transparent",color:"var(--muted)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:"Clear selection"})]})}function WG({bulkDialog:e,bulkBusy:t,selectedCount:r,tagBulkInput:n,onTagBulkInputChange:o,newListName:a,onNewListNameChange:s,newListDesc:l,onNewListDescChange:c,eventsPick:u,eventPickIds:d,onToggleEventPick:f,fixedLists:h,addToListId:p,onAddToListIdChange:v,onClose:m,onApplyTags:b,onAssignEvents:x,onCreateList:w,onAddToList:k}){const j=T=>i.jsx("div",{role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:205,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>!t&&m(),children:i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"20px",width:"min(440px, 92vw)",maxHeight:"80vh",overflow:"auto",boxShadow:"var(--shadow-xl)"},onClick:A=>A.stopPropagation(),children:T})}),_=T=>i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"14px"},children:[i.jsx("button",{type:"button",disabled:t,onClick:m,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Cancel"}),T]});return e==="addTags"||e==="removeTags"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:e==="addTags"?"Add tags":"Remove tags"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Apply to ",r," selected (comma-separated)."]}),i.jsx("input",{value:n,onChange:T=>o(T.target.value),placeholder:"e.g. VIP, Sponsor",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",boxSizing:"border-box"}}),_(i.jsx("button",{type:"button",disabled:t,onClick:()=>b(e==="addTags"?"add_tags":"remove_tags"),style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Apply"}))]})):e==="assignEvents"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"Assign to event(s)"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:[r," people · adds pending membership where missing."]}),i.jsx("div",{style:{maxHeight:"240px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"8px"},children:u.map(T=>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(T._id),onChange:()=>f(T._id)}),T.name]},T._id))}),_(i.jsx("button",{type:"button",disabled:t||d.size===0,onClick:x,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Assign"}))]})):e==="newList"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"New custom list"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Fixed list with ",r," selected people."]}),i.jsx("input",{value:a,onChange:T=>s(T.target.value),placeholder:"List name",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",marginBottom:"8px",boxSizing:"border-box",fontSize:"var(--text-sm)"}}),i.jsx("textarea",{value:l,onChange:T=>c(T.target.value),placeholder:"Description (optional)",rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",boxSizing:"border-box",fontSize:"var(--text-sm)",resize:"vertical"}}),_(i.jsx("button",{type:"button",disabled:t||!a.trim(),onClick:w,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Create"}))]})):e==="addToList"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"Add to existing list"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Append ",r," people to a fixed list."]}),h.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No fixed lists yet. Create one first."}):i.jsx("select",{value:p,onChange:T=>v(T.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"},children:h.map(T=>i.jsx("option",{value:T._id,children:T.name},T._id))}),_(i.jsx("button",{type:"button",disabled:t||h.length===0||!p,onClick:k,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Add"}))]})):null}function i5e(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,tags:e.tags??[]}}const pB=[20,50,100];function hB(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:$G(e)})}function KP({role:e}){const t=a5e[e]??o5e;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 HG({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(yv,{size:10})," Yes"]}):i.jsxs(i.Fragment,{children:[i.jsx(rS,{size:10})," No"]})})}function QP({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 mB({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(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:"var(--muted)"}})]})}function s5e({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,onQr:a,canEdit:s,selectable:l,selected:c,onToggleSelect:u}){const[d,f]=S.useState(!1);return i.jsxs("tr",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{background:d?"var(--secondary)":"transparent",transition:"background 0.12s",cursor:"default",borderBottom:"1px solid var(--border)"},children:[l?i.jsx("td",{style:{padding:"12px 8px 12px 16px",width:"36px"},children:i.jsx("input",{type:"checkbox",checked:!!c,onChange:u,style:{width:"16px",height:"16px",cursor:"pointer"}})}):null,i.jsx("td",{style:{padding:"12px 16px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx(UG,{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(KP,{role:e.role})}),l?i.jsx("td",{style:{padding:"12px 12px"},children:i.jsxs("div",{style:{display:"flex",gap:"3px",flexWrap:"wrap"},children:[e.tags.map(h=>{const p=GP(h);return i.jsx("span",{style:{padding:"1px 6px",borderRadius:"999px",background:p.bg,color:p.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:h},h)}),e.tags.length===0?i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"—"}):null]})}):null,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(QP,{status:e.status})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(HG,{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(Gt,{size:11}):i.jsx(bi,{size:11}),e.checkedIn?"Undo":"Check In"]}),i.jsxs("button",{onClick:a,title:"Check-in QR code (EventBuzz Checkins app)",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: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(Zf,{size:11})," QR"]}),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: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(qh,{size:11})," View"]}),s&&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: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(wi,{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: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(Xr,{size:11})," Delete"]})]})})]})}function l5e({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,onQr:a,canEdit:s,selectable:l,selected:c,onToggleSelect:u}){const[d,f]=S.useState(!1);return i.jsxs("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!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:d?"var(--elevation-sm)":"none",borderColor:d?"var(--primary)":"var(--border)",cursor:"default"},children:[l?i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:!!c,onChange:u,style:{width:"16px",height:"16px",cursor:"pointer"}}),"Select"]}):null,i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[i.jsx(UG,{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(KP,{role:e.role}),i.jsx(QP,{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(bi,{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(Xf,{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(aS,{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(Vi,{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(HG,{checked:e.checkedIn}),i.jsxs("div",{style:{display:"flex",gap:"4px"},children:[i.jsx("button",{onClick:a,title:"Check-in QR code",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:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(Zf,{size:12})}),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:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(qh,{size:12})}),s&&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:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{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:h=>{h.currentTarget.style.color="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})]})}function c5e({p:e,onClose:t,onEdit:r,canEdit:n}){const o=qG(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:$G(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(KP,{role:e.role}),i.jsx(QP,{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(Gt,{size:16})})]}),i.jsx("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:"0"},children:[{icon:i.jsx(Xf,{size:14}),label:"Email",value:e.email},{icon:i.jsx(aS,{size:14}),label:"Phone",value:e.phone},{icon:i.jsx(Vi,{size:14}),label:"Registered",value:e.registrationDate||"—"},{icon:i.jsx(lS,{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(Wh,{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 VG({compactChrome:e=!1}={}){const{selectedEventId:t,setActiveNav:r}=Li(),{user:n}=Mr(),o=Nn(n),s=Si()==="mobile",l=(n==null?void 0:n.role)==="super_admin",c=!e,[u,d]=S.useState([]),[f,h]=S.useState(0),[p,v]=S.useState(1),[m,b]=S.useState(20),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState("All"),[A,P]=S.useState("All"),[N,O]=S.useState(null),[C,I]=S.useState([]),[R,F]=S.useState(0),[M,Y]=S.useState(!1),[X,$]=S.useState(s?"card":"list"),[ee,V]=S.useState(!1),[D,z]=S.useState(!1),[q,G]=S.useState(!1),[U,Q]=S.useState(null),{selectedIds:K,setSelectedIds:re,selectAllMatchingActive:H,setSelectAllMatchingActive:ie,headerSelectRef:de,toggleRow:le,toggleAllVisible:ke,clearSelection:ve}=FG(c?u.map(xe=>xe.id):[],c?[k,N,_,A]:[]),se=S.useCallback(()=>F(xe=>xe+1),[]),be=zG({selectedIds:c?K:[],listOrgId:o,eventId:t??void 0,onMessage:xe=>Q(xe),onClearSelection:ve,onRefresh:se}),[De,ae]=S.useState(null),[ue,Me]=S.useState(null),[Se,Pe]=S.useState(!1),[Ee,Ae]=S.useState(null),[Ye,rt]=S.useState(null),[He,xt]=S.useState(!1),[st,Te]=S.useState(!1),et=S.useRef(null),[Pt,qe]=S.useState(null),[Et,vt]=S.useState(null),Ft=S.useCallback(()=>{t&&(Y(!0),ai.list(t,{page:p,limit:m,q:k||void 0,status:_!=="All"?vB[_]??_:void 0,designation:A!=="All"?A:void 0,tag:N??void 0}).then(xe=>{var Re;Y(!1),(Re=xe.data)!=null&&Re.participants&&(d(xe.data.participants.map(i5e)),h(xe.data.total??0))}).catch(()=>Y(!1)))},[t,p,m,k,_,A,N,R]);S.useEffect(()=>{Ft()},[Ft]),S.useEffect(()=>{if(!t||!c){I([]);return}ai.listDistinctTagsForEvent(t).then(xe=>{var Re;(Re=xe.data)!=null&&Re.tags&&I(xe.data.tags)})},[t,R,c]);const Ce=S.useRef();S.useEffect(()=>(Ce.current=setTimeout(()=>j(x.trim()),300),()=>{Ce.current&&clearTimeout(Ce.current)}),[x]),S.useEffect(()=>{v(1)},[k,_,A,N,m]);const lt=async()=>{var ze,Le;if(!t)return;const xe=await ai.matchingIdsForEvent(t,{q:k||void 0,tag:N??void 0,status:_!=="All"?vB[_]??_:void 0,designation:A!=="All"?A:void 0});if(xe.error){Q(xe.error),ie(!1);return}const Re=((ze=xe.data)==null?void 0:ze.ids)??[];(Le=xe.data)!=null&&Le.capped&&Q(`Note: only the first ${Re.length} matching people are selected (limit). Refine filters if needed.`),re(Re),ie(Re.length>0)},Xe=Math.max(1,Math.ceil(f/m)),Be=u.filter(xe=>xe.checkedIn).length,ct=u.filter(xe=>["Speaker","Moderator","Panelist"].includes(xe.role)).length,Tt=xe=>{const Re=u.find(ze=>ze.id===xe);rt({msg:`Remove "${Re==null?void 0:Re.name}" from this event?`,onConfirm:()=>{t&&ai.remove(xe,t).then(()=>{Ft(),rt(null)})}})},We=xe=>{t&&ai.checkIn(xe,t).then(()=>Ft())},ce=async()=>{if(!t||He)return;xt(!0);const xe=await ai.downloadExport(t);xt(!1),!xe.ok&&"error"in xe?vt(xe.error||"Export failed"):vt(null)},he=async xe=>{var ze;const Re=(ze=xe.target.files)==null?void 0:ze[0];if(!(!Re||!t)){Te(!0);try{const Le=await Re.text(),Qe=await ai.importCsv(t,Le);Qe.data?(qe(Qe.data),Ft()):vt(Qe.error||"Import failed")}catch{vt("Could not read file.")}Te(!1),xe.target.value=""}},je=_!=="All"||A!=="All"||!!N;return t?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[U&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:U}),i.jsx("button",{type:"button",onClick:()=>Q(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:16})})]}),Et&&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:Et}),i.jsx("button",{type:"button",onClick:()=>vt(null),style:{background:"none",border:"none",cursor:"pointer",color:"inherit",padding:"4px"},children:i.jsx(Gt,{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:[f," registered · ",Be," 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:[f," registered · ",Be," checked in on this page"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("input",{ref:et,type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:he}),i.jsxs("button",{type:"button",disabled:He,onClick:ce,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:He?"wait":"pointer",opacity:He?.8:1},onMouseEnter:xe=>{He||(xe.currentTarget.style.borderColor="var(--primary)",xe.currentTarget.style.color="var(--primary)")},onMouseLeave:xe=>{xe.currentTarget.style.borderColor="var(--border)",xe.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(ja,{size:14})," ",He?"Exporting…":s?"Export":"Export CSV"]}),l&&i.jsxs("button",{type:"button",disabled:st,onClick:()=>{var xe;return(xe=et.current)==null?void 0:xe.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:st?"wait":"pointer"},onMouseEnter:xe=>{st||(xe.currentTarget.style.borderColor="var(--primary)",xe.currentTarget.style.color="var(--primary)")},onMouseLeave:xe=>{xe.currentTarget.style.borderColor="var(--border)",xe.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Fl,{size:14})," ",st?"Importing…":s?"Import":"Import CSV"]}),l&&i.jsxs("button",{type:"button",onClick:()=>{Ae(null),Pe(!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(gr,{size:14})," ",s?"Add":"Add Participant"]}),c?i.jsx(n5e,{isMobile:s,onOpenLists:()=>r("participant-lists"),onCreateList:()=>G(!0)}):null]})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:s?"repeat(2, 1fr)":"repeat(4, 1fr)",gap:s?"10px":"12px"},children:[{icon:i.jsx(Ri,{size:14}),label:"Total Registered",value:f,accent:"var(--chart-1)"},{icon:i.jsx(lS,{size:14}),label:"Checked In (this page)",value:Be,accent:"var(--chart-2)",sub:u.length?`${Math.round(Be/u.length*100)}%`:""},{icon:i.jsx(wne,{size:14}),label:"Not Checked In (this page)",value:u.length-Be,accent:"var(--chart-3)"},{icon:i.jsx(Om,{size:14}),label:"Speakers & Staff (this page)",value:ct,accent:"var(--chart-4)"}].map(xe=>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 ${xe.accent}`},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:xe.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:xe.accent,flexShrink:0},children:xe.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:xe.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:xe.label}),xe.sub&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"#16a34a",marginTop:"3px"},children:xe.sub})]})]},xe.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 ${ee?"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:x,onChange:xe=>w(xe.target.value),placeholder:s?"Search…":"Search by name, email or phone…",onFocus:()=>V(!0),onBlur:()=>V(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),x&&i.jsx("button",{onClick:()=>w(""),type:"button",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(Gt,{size:12})})]}),s&&i.jsxs("button",{onClick:()=>z(xe=>!xe),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 12px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${je?"var(--primary)":"var(--border)"}`,background:je?"var(--accent)":"var(--card)",color:je?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",flexShrink:0},children:[i.jsx(tre,{size:13})," ",je?"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(xe=>i.jsxs("button",{onClick:()=>$(xe),style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 10px",height:"36px",background:X===xe?"var(--primary)":"transparent",color:X===xe?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:xe==="card"?"1px solid var(--border)":"none"},children:[xe==="list"?i.jsx(Eb,{size:13}):i.jsx(Cb,{size:13}),!s&&(xe==="list"?"List":"Cards")]},xe))})]}),(!s||D)&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[c?i.jsx(DG,{total:f,loading:M,busy:be.bulkBusy,checked:H,onChange:xe=>{xe?lt():ve()}}):null,i.jsx(mB,{label:"All Statuses",value:_,options:u5e,onChange:T}),i.jsx(mB,{label:"All Designations",value:A,options:d5e,onChange:P}),c?i.jsx(MG,{tagOptions:C,activeTag:N,onChange:O}):null,je&&i.jsxs("button",{type:"button",onClick:()=>{T("All"),P("All"),O(null)},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(Gt,{size:11})," Clear"]})]})]}),c?i.jsx(BG,{selectedCount:K.length,busy:be.bulkBusy,variant:"event",onAddTags:()=>void be.openBulkDialog("addTags"),onRemoveTags:()=>void be.openBulkDialog("removeTags"),onNewList:()=>void be.openBulkDialog("newList"),onAddToList:()=>void be.openBulkDialog("addToList"),onRemoveFromEvent:()=>{window.confirm(`Remove ${K.length} participant(s) from this event?`)&&be.runBulkRemoveFromEvent()},onClearSelection:ve}):null,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:(p-1)*m+1}),"–",i.jsx("strong",{children:Math.min(p*m,f)})," of ",f," participants"]}),M?i.jsx("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):u.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Ri,{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:()=>{w(""),j(""),T("All"),P("All"),O(null),v(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(Gt,{size:13})," Clear all filters"]})]}):X==="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.jsxs("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[c?i.jsx("th",{style:{padding:"9px 8px 9px 16px",width:"36px"},children:i.jsx("input",{ref:de,type:"checkbox",title:"Select visible rows",onChange:ke,style:{width:"16px",height:"16px",cursor:"pointer"}})}):null,(c?["Participant","Role","Tags","Phone","Registered","Status","Checked In",""]:["Participant","Role","Phone","Registered","Status","Checked In",""]).map(xe=>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:xe},xe))]})}),i.jsx("tbody",{children:u.map(xe=>i.jsx(s5e,{p:xe,selectable:c,selected:K.includes(xe.id),onToggleSelect:()=>le(xe.id),onView:()=>ae(xe),onEdit:()=>{Ae(xe.id),Pe(!0)},onDelete:()=>Tt(xe.id),onToggleCheckIn:()=>We(xe.id),onQr:()=>Me(xe),canEdit:l},xe.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:m,onChange:xe=>{b(Number(xe.target.value)),v(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:pB.map(xe=>i.jsx("option",{value:xe,children:xe},xe))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:p<=1,onClick:()=>v(xe=>Math.max(1,xe-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p<=1?"not-allowed":"pointer",color:p<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(vd,{size:16})}),hB(p,Xe).map((xe,Re)=>xe==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e-${Re}`):i.jsx("button",{type:"button",onClick:()=>v(xe),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:p===xe?"var(--primary)":"var(--card)",color:p===xe?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:xe},xe)),i.jsx("button",{type:"button",disabled:p>=Xe,onClick:()=>v(xe=>Math.min(Xe,xe+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p>=Xe?"not-allowed":"pointer",color:p>=Xe?"var(--muted)":"var(--foreground)"},children:i.jsx(ka,{size:16})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:"14px"},children:u.map(xe=>i.jsx(l5e,{p:xe,selectable:c,selected:K.includes(xe.id),onToggleSelect:()=>le(xe.id),onView:()=>ae(xe),onEdit:()=>{Ae(xe.id),Pe(!0)},onDelete:()=>Tt(xe.id),onToggleCheckIn:()=>We(xe.id),onQr:()=>Me(xe),canEdit:l},xe.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:m,onChange:xe=>{b(Number(xe.target.value)),v(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:pB.map(xe=>i.jsx("option",{value:xe,children:xe},xe))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:p<=1,onClick:()=>v(xe=>Math.max(1,xe-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p<=1?"not-allowed":"pointer",color:p<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(vd,{size:16})}),hB(p,Xe).map((xe,Re)=>xe==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e2-${Re}`):i.jsx("button",{type:"button",onClick:()=>v(xe),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:p===xe?"var(--primary)":"var(--card)",color:p===xe?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:xe},xe)),i.jsx("button",{type:"button",disabled:p>=Xe,onClick:()=>v(xe=>Math.min(Xe,xe+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p>=Xe?"not-allowed":"pointer",color:p>=Xe?"var(--muted)":"var(--foreground)"},children:i.jsx(ka,{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"})}),De&&i.jsx(c5e,{p:De,onClose:()=>ae(null),onEdit:()=>{Ae(De.id),ae(null),Pe(!0)},canEdit:l}),ue&&i.jsx(t5e,{open:!0,participantId:ue.id,participantName:ue.name,onClose:()=>Me(null)}),Se&&t&&i.jsx(Qje,{eventId:t,participantId:Ee??void 0,onClose:()=>{Pe(!1),Ae(null)},onSuccess:()=>{Ft(),Pe(!1),Ae(null)}}),Ye&&i.jsx(f5e,{message:Ye.msg,onConfirm:Ye.onConfirm,onCancel:()=>rt(null)}),Pt&&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:()=>qe(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:xe=>xe.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:Pt.created})," added"]}),i.jsxs("li",{children:[i.jsx("strong",{children:Pt.skippedDuplicate})," skipped (email already registered for this event)"]}),Pt.failed>0&&i.jsxs("li",{children:[i.jsx("strong",{children:Pt.failed})," rows failed validation"]})]}),Pt.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:[Pt.errors.map((xe,Re)=>i.jsxs("div",{style:{marginBottom:"6px"},children:["Line ",xe.line,": ",xe.message]},Re)),Pt.failed>Pt.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:()=>qe(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"})]})}),c?i.jsxs(i.Fragment,{children:[i.jsx(WG,{bulkDialog:be.bulkDialog,bulkBusy:be.bulkBusy,selectedCount:K.length,tagBulkInput:be.tagBulkInput,onTagBulkInputChange:be.setTagBulkInput,newListName:be.newListName,onNewListNameChange:be.setNewListName,newListDesc:be.newListDesc,onNewListDescChange:be.setNewListDesc,eventsPick:be.eventsPick,eventPickIds:be.eventPickIds,onToggleEventPick:be.toggleEventPick,fixedLists:be.fixedLists,addToListId:be.addToListId,onAddToListIdChange:be.setAddToListId,onClose:()=>be.setBulkDialog(null),onApplyTags:xe=>void be.runBulkTags(xe),onAssignEvents:()=>void be.runBulkAssignEvents(),onCreateList:()=>void be.runBulkNewList(),onAddToList:()=>void be.runBulkAddToList()}),q?i.jsx(YP,{onClose:()=>G(!1),onCreated:()=>se()}):null]}):null]}):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(Ri,{size:40,style:{opacity:.5}}),i.jsx("p",{style:{fontSize:"var(--text-base)"},children:"Select an event to view participants."})]})}function p5e(e){return`${window.location.origin}/attendance/${e}`}function yB(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const xB={name:"",description:"",allowDuplicateCheckIn:!1,publicLinkEnabled:!0};function h5e(){var re;const{selectedEventId:e}=Li(),[t,r]=S.useState([]),[n,o]=S.useState(!1),[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState(xB),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(""),[_,T]=S.useState([]),[A,P]=S.useState(!1),[N,O]=S.useState(null),[C,I]=S.useState([]),[R,F]=S.useState(0),[M,Y]=S.useState(!1),X=t.find(H=>H._id===l)??null,$=S.useCallback(async()=>{var ie;if(!e)return;o(!0),s(null);const H=await Wc.list(e);if(o(!1),H.error){s(H.error);return}r(((ie=H.data)==null?void 0:ie.attendances)??[])},[e]);S.useEffect(()=>{$()},[$]);const ee=S.useCallback(async()=>{if(!e||!l)return;Y(!0);const H=await Wc.listCheckIns(e,l,{limit:50});Y(!1),H.data&&(I(H.data.checkIns),F(H.data.total))},[e,l]);S.useEffect(()=>{l&&ee()},[l,ee]),S.useEffect(()=>{if(!e||!l)return;const H=setTimeout(async()=>{P(!0);const ie=await Wc.searchParticipants(e,l,k.trim()||void 0);P(!1),ie.data&&T(ie.data.participants)},300);return()=>clearTimeout(H)},[k,e,l]);const V=()=>{h(null),v(xB),d(!0)},D=H=>{var ie,de;h(H._id),v({name:H.name,description:H.description||"",allowDuplicateCheckIn:!!((ie=H.settings)!=null&&ie.allowDuplicateCheckIn),publicLinkEnabled:((de=H.settings)==null?void 0:de.publicLinkEnabled)!==!1}),d(!0)},z=async()=>{var de;if(!e||!p.name.trim())return;b(!0);const H={name:p.name.trim(),description:p.description.trim(),settings:{allowDuplicateCheckIn:p.allowDuplicateCheckIn,publicLinkEnabled:p.publicLinkEnabled}},ie=f?await Wc.update(e,f,H):await Wc.create(e,H);if(b(!1),ie.error){s(ie.error);return}d(!1),await $(),(de=ie.data)!=null&&de._id&&!f&&c(ie.data._id)},q=async H=>{if(!e||!confirm("Archive this attendance session?"))return;const ie=await Wc.remove(e,H);if(ie.error){s(ie.error);return}l===H&&c(null),await $()},G=async H=>{if(!e||!l)return;O(H);const ie=await Wc.checkIn(e,l,H);if(O(null),ie.error){s(ie.error);return}await $(),await ee();const de=await Wc.searchParticipants(e,l,k.trim()||void 0);de.data&&T(de.data.participants)},U=async H=>{try{await navigator.clipboard.writeText(p5e(H)),w("Link copied"),setTimeout(()=>w(null),2e3)}catch{w("Could not copy")}},Q=async H=>{if(!e||!confirm("Regenerate public link? Old links will stop working."))return;const ie=await Wc.regenerateToken(e,H);if(ie.error){s(ie.error);return}await $()},K=async()=>{if(!e||!l||!X)return;const H=X.name.replace(/[^a-z0-9-_]+/gi,"-").slice(0,40);await Wc.downloadExport(e,l,`${H}-check-ins.csv`)};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(hT,{size:20,color:"var(--primary)"}),i.jsx("h1",{style:{margin:0,fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:600},children:"Attendance"})]}),i.jsxs("button",{type:"button",onClick:V,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-sm)"},children:[i.jsx(gr,{size:14})," Add session"]})]}),a&&i.jsxs("div",{style:{margin:"12px 20px 0",padding:"10px 12px",background:"#fef2f2",color:"#b91c1c",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,i.jsx("button",{type:"button",onClick:()=>s(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:14})})]}),x&&i.jsx("div",{style:{margin:"8px 20px 0",fontSize:"var(--text-sm)",color:"var(--primary)"},children:x}),i.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[i.jsxs("div",{style:{width:l?280:"100%",maxWidth:l?280:void 0,borderRight:l?"1px solid var(--border)":void 0,overflow:"auto",flexShrink:0},children:[n&&i.jsx("p",{style:{padding:20,color:"var(--muted)"},children:"Loading…"}),!n&&t.length===0&&i.jsx("p",{style:{padding:20,color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No attendance sessions yet. Create one to start check-ins."}),t.map(H=>i.jsxs("button",{type:"button",onClick:()=>c(H._id),style:{display:"block",width:"100%",textAlign:"left",padding:"14px 16px",border:"none",borderBottom:"1px solid var(--border)",background:l===H._id?"var(--secondary)":"transparent",cursor:"pointer"},children:[i.jsx("div",{style:{fontWeight:600,fontSize:"var(--text-sm)",marginBottom:4},children:H.name}),i.jsxs("div",{style:{fontSize:"11px",color:"var(--muted)"},children:[H.totalCheckedIn??0," check-in",(H.totalCheckedIn??0)===1?"":"s"," ·"," ",H.uniqueParticipants??0," people"]}),H.status==="archived"&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)"},children:"Archived"})]},H._id))]}),X&&e&&i.jsxs("div",{style:{flex:1,overflow:"auto",padding:20,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:20,flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>c(null),style:{display:"none",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",color:"var(--muted)",fontSize:"var(--text-sm)",marginBottom:8},className:"attendance-back-mobile",children:[i.jsx(vd,{size:16})," Back"]}),i.jsx("h2",{style:{margin:0,fontSize:"var(--text-base)",fontWeight:600},children:X.name}),X.description&&i.jsx("p",{style:{margin:"6px 0 0",fontSize:"var(--text-sm)",color:"var(--muted)"},children:X.description})]}),i.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>D(X),title:"Edit",style:Ny,children:i.jsx(wi,{size:14})}),i.jsx("button",{type:"button",onClick:K,title:"Export CSV",style:Ny,children:i.jsx(ja,{size:14})}),i.jsx("button",{type:"button",onClick:()=>U(X.publicToken),title:"Copy public link",style:Ny,disabled:!((re=X.settings)!=null&&re.publicLinkEnabled),children:i.jsx(i2,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Q(X._id),title:"Regenerate link",style:Ny,children:i.jsx(_x,{size:14})}),i.jsx("button",{type:"button",onClick:()=>q(X._id),title:"Archive",style:Ny,children:i.jsx(Xr,{size:14})})]})]}),i.jsxs("div",{style:{marginBottom:24},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:500,marginBottom:8},children:[i.jsx(pi,{size:14,style:{verticalAlign:"middle",marginRight:6}}),"Find participant to check in"]}),i.jsx("input",{type:"search",value:k,onChange:H=>j(H.target.value),placeholder:"Name, email, or phone…",style:cE}),A&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:8},children:"Searching…"}),i.jsxs("div",{style:{marginTop:12,display:"flex",flexDirection:"column",gap:8},children:[_.map(H=>{var de,le;const ie=!H.alreadyCheckedIn||!!((de=X.settings)!=null&&de.allowDuplicateCheckIn);return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)"},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("div",{style:{fontWeight:500,fontSize:"var(--text-sm)"},children:H.displayName}),i.jsx("div",{style:{fontSize:"11px",color:"var(--muted)"},children:[H.email,H.phone].filter(Boolean).join(" · ")||"—"}),H.alreadyCheckedIn&&i.jsxs("div",{style:{fontSize:"11px",color:"#15803d",marginTop:4},children:["Checked in ",H.checkInCount," time",H.checkInCount===1?"":"s",H.lastCheckedInAt?` · ${yB(H.lastCheckedInAt)}`:""]})]}),i.jsxs("button",{type:"button",disabled:!ie||N===H._id,onClick:()=>G(H._id),style:{...g5e,opacity:ie?1:.5},children:[i.jsx(lS,{size:14}),H.alreadyCheckedIn&&((le=X.settings)!=null&&le.allowDuplicateCheckIn)?"Again":"Check in"]})]},H._id)}),!A&&_.length===0&&k.trim()&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No participants found."})]})]}),i.jsxs("div",{children:[i.jsxs("h3",{style:{fontSize:"var(--text-sm)",fontWeight:600,marginBottom:12},children:["Check-ins (",R,")"]}),M&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading…"}),!M&&C.length===0&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No check-ins yet."}),i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-sm)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",textAlign:"left"},children:[i.jsx("th",{style:Ry,children:"Name"}),i.jsx("th",{style:Ry,children:"Email"}),i.jsx("th",{style:Ry,children:"Phone"}),i.jsx("th",{style:Ry,children:"Last check-in"}),i.jsx("th",{style:Ry,children:"Count"})]})}),i.jsx("tbody",{children:C.map(H=>{const ie=[H.firstName,H.lastName].filter(Boolean).join(" ").trim()||"—";return i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:Ly,children:ie}),i.jsx("td",{style:Ly,children:H.email||"—"}),i.jsx("td",{style:Ly,children:H.phone||"—"}),i.jsx("td",{style:Ly,children:yB(H.lastCheckedInAt)}),i.jsx("td",{style:Ly,children:H.checkInCount})]},H._id)})})]})})]})]}),!X&&t.length>0&&i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Select a session to manage check-ins"})]}),u&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:()=>d(!1),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:440,boxShadow:"var(--elevation-sm)"},onClick:H=>H.stopPropagation(),children:[i.jsx("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:i.jsx("h3",{style:{margin:0,fontSize:"var(--text-base)",fontWeight:600},children:f?"Edit session":"New attendance session"})}),i.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:14},children:[i.jsxs("label",{style:bB,children:["Name *",i.jsx("input",{value:p.name,onChange:H=>v(ie=>({...ie,name:H.target.value})),style:cE,placeholder:"e.g. Main entrance – Day 1"})]}),i.jsxs("label",{style:bB,children:["Description",i.jsx("textarea",{value:p.description,onChange:H=>v(ie=>({...ie,description:H.target.value})),style:{...cE,minHeight:72,resize:"vertical"}})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:p.allowDuplicateCheckIn,onChange:H=>v(ie=>({...ie,allowDuplicateCheckIn:H.target.checked}))}),"Allow duplicate check-ins"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:p.publicLinkEnabled,onChange:H=>v(ie=>({...ie,publicLinkEnabled:H.target.checked}))}),"Enable public check-in link"]})]}),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:()=>d(!1),style:m5e,children:"Cancel"}),i.jsx("button",{type:"button",onClick:z,disabled:m||!p.name.trim(),style:v5e,children:m?"Saving…":f?"Save":"Create"})]})]})})]}):i.jsx("div",{style:{padding:24,color:"var(--muted)"},children:"Select an event to manage attendance."})}const Ny={width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},cE={width:"100%",height:40,padding:"0 12px",marginTop:6,borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",boxSizing:"border-box"},bB={display:"block",fontSize:"var(--text-sm)",fontWeight:500},Ry={padding:"8px 10px",fontWeight:600,color:"var(--muted)"},Ly={padding:"10px"},g5e={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-sm)",flexShrink:0},m5e={padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},v5e={padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"#fff",cursor:"pointer",fontSize:"var(--text-sm)"},y5e={id:"venue",prompt:"What is the venue or address for the in-person part of this event?"},x5e={id:"virtualLink",prompt:"What is the meeting or stream URL (e.g. https://…)?"};function YG(e){const t=e.trim();if(!t)return!1;try{return new URL(t.startsWith("http")?t:`https://${t}`),!0}catch{return!1}}function b5e(e,t){const r=[],n=(t.location||"").trim(),o=(t.virtualLink||"").trim();return(e==="Physical"||e==="Hybrid")&&(n||r.push(y5e)),(e==="Virtual"||e==="Hybrid")&&(YG(o)||r.push(x5e)),r}function w5e(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 S5e({gaps:e,mergedPreview:t,organizationId:r,onClose:n,onCreated:o}){const a=S.useMemo(()=>FU(t),[t]),[s,l]=S.useState(()=>[...e]),[c,u]=S.useState(0),[d,f]=S.useState({}),[h,p]=S.useState({}),[v,m]=S.useState(!1),[b,x]=S.useState(null),[w,k]=S.useState(""),[j,_]=S.useState(""),[T,A]=S.useState(""),[P,N]=S.useState(""),[O,C]=S.useState(""),[I,R]=S.useState(""),F=s[c],M=c>=s.length;S.useEffect(()=>{!F||M||(p({}),F.id==="eventName"&&k(d.eventName??a.name??""),F.id==="startEnd"&&(_(d.startLocal??""),A(d.endLocal??"")),F.id==="locationType"&&N(d.locationType||""),F.id==="venue"&&C(d.venue??a.location??""),F.id==="virtualLink"&&R(d.virtualLink??a.virtualLink??""))},[F,M,d,a]);const Y=S.useCallback(q=>h[q],[h]),X=S.useCallback(()=>{const q={};if(!F)return q;if(F.id==="eventName"&&w.trim().length<3&&(q.eventName="Name must be at least 3 characters."),F.id==="startEnd"&&(j.trim()||(q.startLocal="Start is required."),T.trim()||(q.endLocal="End is required."),j&&T)){const G=new Date(j).getTime(),U=new Date(T).getTime();!Number.isNaN(G)&&!Number.isNaN(U)&&U<=G&&(q.endLocal="End must be after start.")}return F.id==="locationType"&&(P||(q.locationType="Select a type.")),F.id==="venue"&&(O.trim()||(q.venue="Venue or address is required.")),F.id==="virtualLink"&&(I.trim()?YG(I)||(q.virtualLink="Enter a valid URL (e.g. https://…)."):q.virtualLink="URL is required."),q},[F,w,j,T,P,O,I]),$=S.useCallback(()=>{if(!F)return d;const q={...d};return F.id==="eventName"&&(q.eventName=w.trim()),F.id==="startEnd"&&(q.startLocal=j,q.endLocal=T),F.id==="locationType"&&(q.locationType=P),F.id==="venue"&&(q.venue=O.trim()),F.id==="virtualLink"&&(q.virtualLink=I.trim()),q},[d,F,w,j,T,P,O,I]),ee=()=>{const q=X();if(Object.keys(q).length>0){p(q);return}const G=$();if(f(G),(F==null?void 0:F.id)==="locationType"&&P){const U=b5e(P,a);U.length>0&&l(Q=>w5e(Q,c,U))}u(U=>U+1)},V=()=>{x(null),p({}),u(q=>Math.max(0,q-1))},D=S.useMemo(()=>{const q=(a.locationType||"physical").toLowerCase(),G={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"},U=d.locationType||G[q]||"Physical",Q=(d.eventName??a.name).trim(),K=(a.description||"").trim()||"—";let re=d.startLocal,H=d.endLocal;if(!re||!H)try{re=new Date(a.startDate).toLocaleString(),H=new Date(a.endDate).toLocaleString()}catch{re=a.startDate,H=a.endDate}const ie=(d.venue??a.location??"").trim()||"—",de=(d.virtualLink??a.virtualLink??"").trim()||"—";return[{k:"Name",v:Q},{k:"Description",v:K},{k:"Type",v:U},{k:"Venue",v:ie},{k:"Virtual link",v:de},{k:"Start",v:re},{k:"End",v:H},{k:"Event type (program)",v:a.type||"conference"},{k:"Status",v:a.status||"draft"}]},[d,a]),z=async()=>{x(null);let q;try{q=LU(a,d,r)}catch(U){x(U instanceof Error?U.message:"Invalid event data.");return}m(!0);const G=await Lr.create(q);if(m(!1),G.data!=null&&!G.error){const U=G.data._id;U?(o(U),n()):x("Could not create the event.")}else x(G.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 ",M?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(Gt,{size:14})})]})}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[!M&&F&&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:F.prompt})]}),F.id==="eventName"&&i.jsxs(lr,{error:Y("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Qr,...Y("eventName")?{borderColor:"var(--destructive)"}:{}},value:w,onChange:q=>k(q.target.value)})]}),F.id==="startEnd"&&i.jsxs(No,{children:[i.jsxs(lr,{error:Y("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...Y("startLocal")?{borderColor:"var(--destructive)"}:{}},value:j,onChange:q=>_(q.target.value)})]}),i.jsxs(lr,{error:Y("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...Y("endLocal")?{borderColor:"var(--destructive)"}:{}},value:T,onChange:q=>A(q.target.value)})]})]}),F.id==="locationType"&&i.jsxs(lr,{error:Y("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...Y("locationType")?{borderColor:"var(--destructive)"}:{}},value:P,onChange:q=>N(q.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"})]})})]}),F.id==="venue"&&i.jsxs(lr,{error:Y("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Qr,...Y("venue")?{borderColor:"var(--destructive)"}:{}},value:O,onChange:q=>C(q.target.value)})]}),F.id==="virtualLink"&&i.jsxs(lr,{error:Y("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...Y("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:I,onChange:q=>R(q.target.value)})]})]}),M&&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:D.map(q=>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:q.k}),i.jsx("span",{style:{color:"var(--foreground)",wordBreak:"break-word"},children:q.v})]},q.k))})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:b})]}),i.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--border)",display:"flex",gap:"10px",justifyContent:"flex-end",flexShrink:0},children:[!M&&c>0&&i.jsx("button",{type:"button",onClick:V,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"}),!M&&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"}),M&&i.jsx("button",{type:"button",disabled:v,onClick:()=>void z(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:v?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:v?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:v?"Creating…":"Create event"})]})]})]})}function j5e({organizationId:e,onCreated:t}){const[r,n]=S.useState(""),[o,a]=S.useState(!1),[s,l]=S.useState(null),[c,u]=S.useState(!1),[d,f]=S.useState([]),[h,p]=S.useState(null),v=()=>{(async()=>{var b;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 x=await Lr.aiExtractPreview({description:m,organization:e});if(x.error!=null||x.data==null){l(x.error||"Could not analyze the description.");return}const{gaps:w,mergedPreview:k}=x.data,j=Array.isArray(w)?w:[],_=k!=null&&typeof k=="object"?k:{};if(j.length===0)try{const T=FU(_),A=LU(T,{},e),P=await Lr.create(A);if(P.error!=null||!((b=P.data)!=null&&b._id)){l(P.error||"Could not create the event.");return}t(String(P.data._id)),n("")}catch(T){l(T instanceof Error?T.message:"Could not create the event.")}else f(j),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:v,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(ine,{size:16}),o?"Analyzing…":"Generate your Event using AI"]})]}),c&&h!=null&&i.jsx(S5e,{gaps:d,mergedPreview:h,organizationId:e,onClose:()=>{u(!1),p(null)},onCreated:m=>{u(!1),p(null),n(""),t(m)}})]})}function GG({onClose:e,onSuccess:t,onCreated:r,organizationId:n}){const{user:o}=Mr(),a=Nn(o),s=n??a??void 0,[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState({}),[A,P]=S.useState(!1),[N,O]=S.useState(null),C=S.useCallback(F=>_[F],[_]),I=S.useCallback(()=>{const F={};if(l.trim().length<3&&(F.eventName="Name must be at least 3 characters."),f||(F.locationType="Select a type."),(f==="Physical"||f==="Hybrid")&&(p.trim()||(F.venue="Venue or address is required.")),(f==="Virtual"||f==="Hybrid")&&(m.trim()||(F.virtualLink="Virtual link is required.")),x.trim()||(F.startLocal="Start date and time are required."),k.trim()||(F.endLocal="End date and time are required."),x&&k){const Y=new Date(x).getTime(),X=new Date(k).getTime();!Number.isNaN(Y)&&!Number.isNaN(X)&&X<=Y&&(F.endLocal="End must be after start.")}return F},[l,f,p,m,x,k]),R=async()=>{O(null);const F=I();if(Object.keys(F).length>0){T(F);return}T({});let M;try{M=lae({eventName:l,description:u,locationTypeLabel:f,venue:p,virtualLink:m,startLocal:x,endLocal:k,organizationId:s})}catch(X){O(X instanceof Error?X.message:"Invalid dates.");return}P(!0);const Y=await Lr.create(M);if(P(!1),Y.data!=null&&!Y.error){const X=Y.data._id;X&&(r==null||r(X)),t==null||t(),e()}else O(Y.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(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:A,onClick:()=>void R(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:A?"var(--secondary)":"var(--primary)",color:A?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:A?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:A?"Creating…":"Create event"})]})]}),N?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"10px 0 0"},children:N}):null]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(lr,{error:C("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Qr,...C("eventName")?{borderColor:"var(--destructive)"}:{}},value:l,onChange:F=>c(F.target.value),autoComplete:"off"})]}),i.jsxs(lr,{error:C("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"72px",...C("description")?{borderColor:"var(--destructive)"}:{}},value:u,onChange:F=>d(F.target.value)})]}),i.jsxs(lr,{error:C("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...C("locationType")?{borderColor:"var(--destructive)"}:{}},value:f,onChange:F=>h(F.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:C("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Qr,...C("venue")?{borderColor:"var(--destructive)"}:{}},value:p,onChange:F=>v(F.target.value)})]}),(f==="Virtual"||f==="Hybrid")&&i.jsxs(lr,{error:C("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...C("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:m,onChange:F=>b(F.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:C("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...C("startLocal")?{borderColor:"var(--destructive)"}:{}},value:x,onChange:F=>w(F.target.value)})]}),i.jsxs(lr,{error:C("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...C("endLocal")?{borderColor:"var(--destructive)"}:{}},value:k,onChange:F=>j(F.target.value)})]})]})]})]})]})}function k5e(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 _5e({msg:e,onDone:t}){return S.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(bv,{size:13})," ",e]})}function C5e(){const{setActiveNav:e,setSelectedEventId:t}=Li(),{user:r}=Mr(),n=Nn(r),o=k5e(r??null),[a,s]=S.useState(null),[l,c]=S.useState(!1),[u,d]=S.useState(!1),h=Si()==="mobile",p=v=>{v==="event"?c(!0):(v==="qna"||v==="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(j5e,{organizationId:n,onCreated:v=>{t(v),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(uE,{icon:i.jsx(Vi,{size:32}),title:"Create new event",onClick:()=>p("event")}),i.jsx(uE,{icon:i.jsx($h,{size:32}),title:"Create Q&A Session",onClick:()=>p("qna")}),i.jsx(uE,{icon:i.jsx(pT,{size:32}),title:"Create quiz or poll",onClick:()=>p("quiz-poll")})]})}),u&&i.jsx(E5e,{onClose:()=>d(!1)}),l&&i.jsx(GG,{organizationId:n,onClose:()=>c(!1),onCreated:v=>{t(v),e("dashboard")}}),a&&i.jsx(_5e,{msg:a,onDone:()=>s(null)})]})}function uE({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 E5e({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 on(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 Zs(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Da(e,t){const r=on(e);return isNaN(t)?Zs(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function gc(e,t){const r=on(e);if(isNaN(t))return Zs(e,NaN);if(!t)return r;const n=r.getDate(),o=Zs(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 XP=6048e5,A5e=864e5;let T5e={};function Wb(){return T5e}function cu(e,t){var l,c,u,d;const r=Wb(),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=on(e),a=o.getDay(),s=(a=o.getTime()?r+1:t.getTime()>=s.getTime()?r:r-1}function cv(e){const t=on(e);return t.setHours(0,0,0,0),t}function vw(e){const t=on(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 eu(e,t){const r=cv(e),n=cv(t),o=+r-vw(r),a=+n-vw(n);return Math.round((o-a)/A5e)}function P5e(e){const t=KG(e),r=Zs(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),Oh(r)}function h6(e,t){const r=t*7;return Da(e,r)}function I5e(e,t){return gc(e,t*12)}function O5e(e){let t;return e.forEach(function(r){const n=on(r);(t===void 0||t{const n=on(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function ds(e,t){const r=cv(e),n=cv(t);return+r==+n}function ZP(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function R5e(e){if(!ZP(e)&&typeof e!="number")return!1;const t=on(e);return!isNaN(Number(t))}function ub(e,t){const r=on(e),n=on(t),o=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return o*12+a}function L5e(e,t,r){const n=cu(e,r),o=cu(t,r),a=+n-vw(n),s=+o-vw(o);return Math.round((a-s)/XP)}function JP(e){const t=on(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function gs(e){const t=on(e);return t.setDate(1),t.setHours(0,0,0,0),t}function QG(e){const t=on(e),r=Zs(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function e8(e,t){var l,c,u,d;const r=Wb(),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=on(e),a=o.getDay(),s=(a{let n;const o=F5e[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 dE(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const M5e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},D5e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},B5e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},W5e={date:dE({formats:M5e,defaultWidth:"full"}),time:dE({formats:D5e,defaultWidth:"full"}),dateTime:dE({formats:B5e,defaultWidth:"full"})},q5e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$5e=(e,t,r,n)=>q5e[e];function Fy(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 U5e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},H5e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},V5e={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"]},Y5e={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"]},G5e={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"}},K5e={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"}},Q5e=(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"},X5e={ordinalNumber:Q5e,era:Fy({values:U5e,defaultWidth:"wide"}),quarter:Fy({values:H5e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Fy({values:V5e,defaultWidth:"wide"}),day:Fy({values:Y5e,defaultWidth:"wide"}),dayPeriod:Fy({values:G5e,defaultWidth:"wide",formattingValues:K5e,defaultFormattingWidth:"wide"})};function zy(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)?J5e(l,f=>f.test(s)):Z5e(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 Z5e(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function J5e(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 tke=/^(\d+)(th|st|nd|rd)?/i,rke=/\d+/i,nke={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},ike={any:[/^b/i,/^(a|c)/i]},oke={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ake={any:[/1/i,/2/i,/3/i,/4/i]},ske={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},lke={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]},cke={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},uke={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]},dke={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},fke={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}},pke={ordinalNumber:eke({matchPattern:tke,parsePattern:rke,valueCallback:e=>parseInt(e,10)}),era:zy({matchPatterns:nke,defaultMatchWidth:"wide",parsePatterns:ike,defaultParseWidth:"any"}),quarter:zy({matchPatterns:oke,defaultMatchWidth:"wide",parsePatterns:ake,defaultParseWidth:"any",valueCallback:e=>e+1}),month:zy({matchPatterns:ske,defaultMatchWidth:"wide",parsePatterns:lke,defaultParseWidth:"any"}),day:zy({matchPatterns:cke,defaultMatchWidth:"wide",parsePatterns:uke,defaultParseWidth:"any"}),dayPeriod:zy({matchPatterns:dke,defaultMatchWidth:"any",parsePatterns:fke,defaultParseWidth:"any"})},ZG={code:"en-US",formatDistance:z5e,formatLong:W5e,formatRelative:$5e,localize:X5e,match:pke,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hke(e){const t=on(e);return eu(t,QG(t))+1}function JG(e){const t=on(e),r=+Oh(t)-+P5e(t);return Math.round(r/XP)+1}function eK(e,t){var d,f,h,p;const r=on(e),n=r.getFullYear(),o=Wb(),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=Zs(e,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);const l=cu(s,t),c=Zs(e,0);c.setFullYear(n,0,a),c.setHours(0,0,0,0);const u=cu(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function gke(e,t){var l,c,u,d;const r=Wb(),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=eK(e,t),a=Zs(e,0);return a.setFullYear(o,0,n),a.setHours(0,0,0,0),cu(a,t)}function tK(e,t){const r=on(e),n=+cu(r,t)-+gke(r,t);return Math.round(n/XP)+1}function In(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const bf={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return In(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):In(r+1,2)},d(e,t){return In(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 In(e.getHours()%12||12,t.length)},H(e,t){return In(e.getHours(),t.length)},m(e,t){return In(e.getMinutes(),t.length)},s(e,t){return In(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return In(o,t.length)}},$g={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wB={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 bf.y(e,t)},Y:function(e,t,r,n){const o=eK(e,n),a=o>0?o:1-o;if(t==="YY"){const s=a%100;return In(s,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):In(a,t.length)},R:function(e,t){const r=KG(e);return In(r,t.length)},u:function(e,t){const r=e.getFullYear();return In(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 In(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 In(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 bf.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 In(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=tK(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):In(o,t.length)},I:function(e,t,r){const n=JG(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):In(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):bf.d(e,t)},D:function(e,t,r){const n=hke(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):In(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 In(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 In(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 In(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=$g.noon:n===0?o=$g.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=$g.evening:n>=12?o=$g.afternoon:n>=4?o=$g.morning:o=$g.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 bf.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):bf.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):In(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):In(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):bf.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):bf.s(e,t)},S:function(e,t){return bf.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return jB(n);case"XXXX":case"XX":return Zp(n);case"XXXXX":case"XXX":default:return Zp(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return jB(n);case"xxxx":case"xx":return Zp(n);case"xxxxx":case"xxx":default:return Zp(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+SB(n,":");case"OOOO":default:return"GMT"+Zp(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+SB(n,":");case"zzzz":default:return"GMT"+Zp(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return In(n,t.length)},T:function(e,t,r){const n=e.getTime();return In(n,t.length)}};function SB(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+In(a,2)}function jB(e,t){return e%60===0?(e>0?"-":"+")+In(Math.abs(e)/60,2):Zp(e,t)}function Zp(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=In(Math.trunc(n/60),2),a=In(n%60,2);return r+o+t+a}const kB=(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"})}},rK=(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"})}},mke=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return kB(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}}",kB(n,t)).replace("{{time}}",rK(o,t))},vke={p:rK,P:mke},yke=/^D+$/,xke=/^Y+$/,bke=["D","DD","YY","YYYY"];function wke(e){return yke.test(e)}function Ske(e){return xke.test(e)}function jke(e,t,r){const n=kke(e,t,r);if(console.warn(n),bke.includes(e))throw new RangeError(n)}function kke(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 _ke=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Cke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Eke=/^'([^]*?)'?$/,Ake=/''/g,Tke=/[a-zA-Z]/;function Xh(e,t,r){var d,f,h,p,v,m,b,x;const n=Wb(),o=(r==null?void 0:r.locale)??n.locale??ZG,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=(v=r==null?void 0:r.locale)==null?void 0:v.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((x=(b=n.locale)==null?void 0:b.options)==null?void 0:x.weekStartsOn)??0,l=on(e);if(!R5e(l))throw new RangeError("Invalid time value");let c=t.match(Cke).map(w=>{const k=w[0];if(k==="p"||k==="P"){const j=vke[k];return j(w,o.formatLong)}return w}).join("").match(_ke).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const k=w[0];if(k==="'")return{isToken:!1,value:Pke(w)};if(wB[k])return{isToken:!0,value:w};if(k.match(Tke))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)&&Ske(k)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&wke(k))&&jke(k,t,String(e));const j=wB[k[0]];return j(l,k,o.localize,u)}).join("")}function Pke(e){const t=e.match(Eke);return t?t[1].replace(Ake,"'"):e}function Ike(e){const t=on(e),r=t.getFullYear(),n=t.getMonth(),o=Zs(e,0);return o.setFullYear(r,n+1,0),o.setHours(0,0,0,0),o.getDate()}function Oke(e){return Math.trunc(+on(e)/1e3)}function Nke(e){const t=on(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function Rke(e,t){return L5e(Nke(e),gs(e),t)+1}function g6(e,t){const r=on(e),n=on(t);return r.getTime()>n.getTime()}function nK(e,t){const r=on(e),n=on(t);return+r<+n}function t8(e,t){const r=on(e),n=on(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function Lke(e,t){const r=on(e),n=on(t);return r.getFullYear()===n.getFullYear()}function fE(e,t){return Da(e,-t)}function pE(e,t){const r=on(e),n=r.getFullYear(),o=r.getDate(),a=Zs(e,0);a.setFullYear(n,t,15),a.setHours(0,0,0,0);const s=Ike(a);return r.setMonth(t,Math.min(o,s)),r}function _B(e,t){const r=on(e);return isNaN(+r)?Zs(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(h_e,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:o,previousMonth:n,onPreviousClick:h,onNextClick:p})}function g_e(e){var t,r=Zn(),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:aK,u;return o?u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?u=i.jsx(CB,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?u=i.jsxs(i.Fragment,{children:[i.jsx(CB,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),i.jsx(EB,{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(EB,{displayMonth:e.displayMonth,id:e.id})]}),i.jsx("div",{className:n.caption,style:a.caption,children:u})}function m_e(e){var t=Zn(),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 v_e(e,t,r){for(var n=r?Oh(new Date):cu(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var s=Da(n,a);o.push(s)}return o}function y_e(){var e=Zn(),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=v_e(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 x_e(){var e,t=Zn(),r=t.classNames,n=t.styles,o=t.components,a=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:y_e;return i.jsx("thead",{style:n.head,className:r.head,children:i.jsx(a,{})})}function b_e(e){var t=Zn(),r=t.locale,n=t.formatters.formatDay;return i.jsx(i.Fragment,{children:n(e.date,{locale:r})})}var r8=S.createContext(void 0);function w_e(e){if(!qb(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return i.jsx(r8.Provider,{value:t,children:e.children})}return i.jsx(S_e,{initialProps:e.initialProps,children:e.children})}function S_e(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 v=!!(d.selected&&o&&(n==null?void 0:n.length)===o);if(!v){var m=!!(!d.selected&&a&&(n==null?void 0:n.length)===a);if(!m){var b=n?iK([],n):[];if(d.selected){var x=b.findIndex(function(w){return ds(u,w)});b.splice(x,1)}else b.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,b,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=a&&n.length>a-1,f=n.some(function(h){return ds(h,u)});return!!(d&&!f)});var c={selected:n,onDayClick:s,modifiers:l};return i.jsx(r8.Provider,{value:c,children:r})}function n8(){var e=S.useContext(r8);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function j_e(e,t){var r=t||{},n=r.from,o=r.to;return n&&o?ds(o,e)&&ds(n,e)?void 0:ds(o,e)?{from:o,to:void 0}:ds(n,e)?void 0:g6(n,e)?{from:e,to:o}:{from:n,to:e}:o?g6(e,o)?{from:o,to:e}:{from:e,to:o}:n?nK(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var i8=S.createContext(void 0);function k_e(e){if(!$b(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return i.jsx(i8.Provider,{value:t,children:e.children})}return i.jsx(__e,{initialProps:e.initialProps,children:e.children})}function __e(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,v,m){var b,x;(b=t.onDayClick)===null||b===void 0||b.call(t,p,v,m);var w=j_e(p,n);(x=t.onSelect)===null||x===void 0||x.call(t,w,p,v,m)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],s?(d.range_end=[s],ds(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:fE(a,l-1),before:Da(a,l-1)}),a&&s&&d.disabled.push({after:a,before:Da(a,l-1)}),!a&&s&&d.disabled.push({after:fE(s,l-1),before:Da(s,l-1)})),c){if(a&&!s&&(d.disabled.push({before:Da(a,-c+1)}),d.disabled.push({after:Da(a,c-1)})),a&&s){var f=eu(s,a)+1,h=c-f;d.disabled.push({before:fE(a,h)}),d.disabled.push({after:Da(s,h)})}!a&&s&&(d.disabled.push({before:Da(s,-c+1)}),d.disabled.push({after:Da(s,c-1)}))}return i.jsx(i8.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function o8(){var e=S.useContext(i8);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function W1(e){return Array.isArray(e)?iK([],e):e!==void 0?[e]:[]}function C_e(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],o=r[1];t[n]=W1(o)}),t}var mc;(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"})(mc||(mc={}));var E_e=mc.Selected,Gu=mc.Disabled,A_e=mc.Hidden,T_e=mc.Today,hE=mc.RangeEnd,gE=mc.RangeMiddle,mE=mc.RangeStart,P_e=mc.Outside;function I_e(e,t,r){var n,o=(n={},n[E_e]=W1(e.selected),n[Gu]=W1(e.disabled),n[A_e]=W1(e.hidden),n[T_e]=[e.today],n[hE]=[],n[gE]=[],n[mE]=[],n[P_e]=[],n);return e.fromDate&&o[Gu].push({before:e.fromDate}),e.toDate&&o[Gu].push({after:e.toDate}),qb(e)?o[Gu]=o[Gu].concat(t.modifiers[Gu]):$b(e)&&(o[Gu]=o[Gu].concat(r.modifiers[Gu]),o[mE]=r.modifiers[mE],o[gE]=r.modifiers[gE],o[hE]=r.modifiers[hE]),o}var cK=S.createContext(void 0);function O_e(e){var t=Zn(),r=n8(),n=o8(),o=I_e(t,r,n),a=C_e(t.modifiers),s=Sr(Sr({},o),a);return i.jsx(cK.Provider,{value:s,children:e.children})}function uK(){var e=S.useContext(cK);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function N_e(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function R_e(e){return!!(e&&typeof e=="object"&&"from"in e)}function L_e(e){return!!(e&&typeof e=="object"&&"after"in e)}function F_e(e){return!!(e&&typeof e=="object"&&"before"in e)}function z_e(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function M_e(e,t){var r,n=t.from,o=t.to;if(n&&o){var a=eu(o,n)<0;a&&(r=[o,n],n=r[0],o=r[1]);var s=eu(e,n)>=0&&eu(o,e)>=0;return s}return o?ds(o,e):n?ds(n,e):!1}function D_e(e){return ZP(e)}function B_e(e){return Array.isArray(e)&&e.every(ZP)}function W_e(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(D_e(r))return ds(e,r);if(B_e(r))return r.includes(e);if(R_e(r))return M_e(e,r);if(z_e(r))return r.dayOfWeek.includes(e.getDay());if(N_e(r)){var n=eu(r.before,e),o=eu(r.after,e),a=n>0,s=o<0,l=g6(r.before,r.after);return l?s&&a:a||s}return L_e(r)?eu(e,r.after)>0:F_e(r)?eu(r.before,e)>0:typeof r=="function"?r(e):!1})}function a8(e,t,r){var n=Object.keys(t).reduce(function(a,s){var l=t[s];return W_e(e,l)&&a.push(s),a},[]),o={};return n.forEach(function(a){return o[a]=!0}),r&&!t8(e,r)&&(o.outside=!0),o}function q_e(e,t){for(var r=gs(e[0]),n=JP(e[e.length-1]),o,a,s=r;s<=n;){var l=a8(s,t),c=!l.disabled&&!l.hidden;if(!c){s=Da(s,1);continue}if(l.selected)return s;l.today&&!a&&(a=s),o||(o=s),s=Da(s,1)}return a||o}var $_e=365;function dK(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:Da,week:h6,month:gc,year:I5e,startOfWeek:function(b){return o.ISOWeek?Oh(b):cu(b,{locale:f,weekStartsOn:c})},endOfWeek:function(b){return o.ISOWeek?XG(b):e8(b,{locale:f,weekStartsOn:c})}},p=h[r](e,n==="after"?1:-1);n==="before"&&u?p=O5e([u,p]):n==="after"&&d&&(p=N5e([d,p]));var v=!0;if(a){var m=a8(p,a);v=!m.disabled&&!m.hidden}return v?p:l.count>$_e?l.lastFocused:dK(p,{moveBy:r,direction:n,context:o,modifiers:a,retry:Sr(Sr({},l),{count:l.count+1})})}var fK=S.createContext(void 0);function U_e(e){var t=Ub(),r=uK(),n=S.useState(),o=n[0],a=n[1],s=S.useState(),l=s[0],c=s[1],u=q_e(t.displayMonths,r),d=o??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(o),a(void 0)},h=function(b){a(b)},p=Zn(),v=function(b,x){if(o){var w=dK(o,{moveBy:b,direction:x,context:p,modifiers:r});ds(o,w)||(t.goToDate(w,o),h(w))}},m={focusedDay:o,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return v("day","after")},focusDayBefore:function(){return v("day","before")},focusWeekAfter:function(){return v("week","after")},focusWeekBefore:function(){return v("week","before")},focusMonthBefore:function(){return v("month","before")},focusMonthAfter:function(){return v("month","after")},focusYearBefore:function(){return v("year","before")},focusYearAfter:function(){return v("year","after")},focusStartOfWeek:function(){return v("startOfWeek","before")},focusEndOfWeek:function(){return v("endOfWeek","after")}};return i.jsx(fK.Provider,{value:m,children:e.children})}function s8(){var e=S.useContext(fK);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function H_e(e,t){var r=uK(),n=a8(e,r,t);return n}var l8=S.createContext(void 0);function V_e(e){if(!JS(e.initialProps)){var t={selected:void 0};return i.jsx(l8.Provider,{value:t,children:e.children})}return i.jsx(Y_e,{initialProps:e.initialProps,children:e.children})}function Y_e(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(l8.Provider,{value:o,children:r})}function pK(){var e=S.useContext(l8);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function G_e(e,t){var r=Zn(),n=pK(),o=n8(),a=o8(),s=s8(),l=s.focusDayAfter,c=s.focusDayBefore,u=s.focusWeekAfter,d=s.focusWeekBefore,f=s.blur,h=s.focus,p=s.focusMonthBefore,v=s.focusMonthAfter,m=s.focusYearBefore,b=s.focusYearAfter,x=s.focusStartOfWeek,w=s.focusEndOfWeek,k=function(X){var $,ee,V,D;JS(r)?($=n.onDayClick)===null||$===void 0||$.call(n,e,t,X):qb(r)?(ee=o.onDayClick)===null||ee===void 0||ee.call(o,e,t,X):$b(r)?(V=a.onDayClick)===null||V===void 0||V.call(a,e,t,X):(D=r.onDayClick)===null||D===void 0||D.call(r,e,t,X)},j=function(X){var $;h(e),($=r.onDayFocus)===null||$===void 0||$.call(r,e,t,X)},_=function(X){var $;f(),($=r.onDayBlur)===null||$===void 0||$.call(r,e,t,X)},T=function(X){var $;($=r.onDayMouseEnter)===null||$===void 0||$.call(r,e,t,X)},A=function(X){var $;($=r.onDayMouseLeave)===null||$===void 0||$.call(r,e,t,X)},P=function(X){var $;($=r.onDayPointerEnter)===null||$===void 0||$.call(r,e,t,X)},N=function(X){var $;($=r.onDayPointerLeave)===null||$===void 0||$.call(r,e,t,X)},O=function(X){var $;($=r.onDayTouchCancel)===null||$===void 0||$.call(r,e,t,X)},C=function(X){var $;($=r.onDayTouchEnd)===null||$===void 0||$.call(r,e,t,X)},I=function(X){var $;($=r.onDayTouchMove)===null||$===void 0||$.call(r,e,t,X)},R=function(X){var $;($=r.onDayTouchStart)===null||$===void 0||$.call(r,e,t,X)},F=function(X){var $;($=r.onDayKeyUp)===null||$===void 0||$.call(r,e,t,X)},M=function(X){var $;switch(X.key){case"ArrowLeft":X.preventDefault(),X.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":X.preventDefault(),X.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":X.preventDefault(),X.stopPropagation(),u();break;case"ArrowUp":X.preventDefault(),X.stopPropagation(),d();break;case"PageUp":X.preventDefault(),X.stopPropagation(),X.shiftKey?m():p();break;case"PageDown":X.preventDefault(),X.stopPropagation(),X.shiftKey?b():v();break;case"Home":X.preventDefault(),X.stopPropagation(),x();break;case"End":X.preventDefault(),X.stopPropagation(),w();break}($=r.onDayKeyDown)===null||$===void 0||$.call(r,e,t,X)},Y={onClick:k,onFocus:j,onBlur:_,onKeyDown:M,onKeyUp:F,onMouseEnter:T,onMouseLeave:A,onPointerEnter:P,onPointerLeave:N,onTouchCancel:O,onTouchEnd:C,onTouchMove:I,onTouchStart:R};return Y}function K_e(){var e=Zn(),t=pK(),r=n8(),n=o8(),o=JS(e)?t.selected:qb(e)?r.selected:$b(e)?n.selected:void 0;return o}function Q_e(e){return Object.values(mc).includes(e)}function X_e(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(Q_e(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function Z_e(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 J_e(e,t,r){var n,o,a,s=Zn(),l=s8(),c=H_e(e,t),u=G_e(e,c),d=K_e(),f=!!(s.onDayClick||s.mode!=="default");S.useEffect(function(){var T;c.outside||l.focusedDay&&f&&ds(l.focusedDay,e)&&((T=r.current)===null||T===void 0||T.focus())},[l.focusedDay,e,r,f,c.outside]);var h=X_e(s,c).join(" "),p=Z_e(s,c),v=!!(c.outside&&!s.showOutsideDays||c.hidden),m=(a=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:b_e,b=i.jsx(m,{date:e,displayMonth:t,activeModifiers:c}),x={style:p,className:h,children:b,role:"gridcell"},w=l.focusTarget&&ds(l.focusTarget,e)&&!c.outside,k=l.focusedDay&&ds(l.focusedDay,e),j=Sr(Sr(Sr({},x),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=k||w?0:-1,n)),u),_={isButton:f,isHidden:v,activeModifiers:c,selectedDays:d,buttonProps:j,divProps:x};return _}function eCe(e){var t=S.useRef(null),r=J_e(e.date,e.displayMonth,t);return r.isHidden?i.jsx("div",{role:"gridcell"}):r.isButton?i.jsx(yw,Sr({name:"day",ref:t},r.buttonProps)):i.jsx("div",Sr({},r.divProps))}function tCe(e){var t=e.number,r=e.dates,n=Zn(),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(yw,{name:"week-number","aria-label":f,className:s.weeknumber,style:a.weeknumber,onClick:h,children:d})}function rCe(e){var t,r,n=Zn(),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:eCe,u=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:tCe,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})},Oke(f))})]})}function AB(e,t,r){for(var n=r!=null&&r.ISOWeek?XG(t):e8(t,r),o=r!=null&&r.ISOWeek?Oh(e):cu(e,r),a=eu(n,o),s=[],l=0;l<=a;l++)s.push(Da(o,l));var c=s.reduce(function(u,d){var f=r!=null&&r.ISOWeek?JG(d):tK(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 nCe(e,t){var r=AB(gs(e),JP(e),t);if(t!=null&&t.useFixedWeeks){var n=Rke(e,t);if(n<6){var o=r[r.length-1],a=o.dates[o.dates.length-1],s=h6(a,6-n),l=AB(h6(a,1),s,t);r.push.apply(r,l)}}return r}function iCe(e){var t,r,n,o=Zn(),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,v=nCe(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:x_e,b=(r=d==null?void 0:d.Row)!==null&&r!==void 0?r:rCe,x=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:m_e;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:v.map(function(w){return i.jsx(b,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),i.jsx(x,{displayMonth:e.displayMonth})]})}function oCe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var aCe=oCe()?S.useLayoutEffect:S.useEffect,vE=!1,sCe=0;function TB(){return"react-day-picker-".concat(++sCe)}function lCe(e){var t,r=e??(vE?TB():null),n=S.useState(r),o=n[0],a=n[1];return aCe(function(){o===null&&a(TB())},[]),S.useEffect(function(){vE===!1&&(vE=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function cCe(e){var t,r,n=Zn(),o=n.dir,a=n.classNames,s=n.styles,l=n.components,c=Ub().displayMonths,u=lCe(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,v=e.displayIndex===c.length-1,m=!p&&!v;o==="rtl"&&(t=[p,v],v=t[0],p=t[1]),p&&(f.push(a.caption_start),h=Sr(Sr({},h),s.caption_start)),v&&(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 b=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:g_e;return i.jsxs("div",{className:f.join(" "),style:h,children:[i.jsx(b,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(iCe,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function uCe(e){var t=Zn(),r=t.classNames,n=t.styles;return i.jsx("div",{className:r.months,style:n.months,children:e.children})}function dCe(e){var t,r,n=e.initialProps,o=Zn(),a=s8(),s=Ub(),l=S.useState(!1),c=l[0],u=l[1];S.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(v){return v.startsWith("data-")}).reduce(function(v,m){var b;return Sr(Sr({},v),(b={},b[m]=n[m],b))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:uCe;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(v,m){return i.jsx(cCe,{displayIndex:m,displayMonth:v},m)})})}))}function fCe(e){var t=e.children,r=Fke(e,["children"]);return i.jsx(t_e,{initialProps:r,children:i.jsx(d_e,{children:i.jsx(V_e,{initialProps:r,children:i.jsx(w_e,{initialProps:r,children:i.jsx(k_e,{initialProps:r,children:i.jsx(O_e,{children:i.jsx(U_e,{children:t})})})})})})})}function pCe(e){return i.jsx(fCe,Sr({},e,{children:i.jsx(dCe,{initialProps:e})}))}const PB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,IB=Fr,hCe=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return IB(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=PB(d)||PB(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(v=>{let[m,b]=v;return Array.isArray(b)?b.includes({...a,...l}[m]):{...a,...l}[m]===b})?[...u,f,h]:u},[]);return IB(e,s,c,r==null?void 0:r.class,r==null?void 0:r.className)},OB=hCe("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 gCe({className:e,classNames:t,showOutsideDays:r=!0,...n}){return i.jsx(pCe,{showOutsideDays:r,className:ea("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:ea(OB({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:ea("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:ea(OB({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(vd,{className:ea("size-4",o),...a}),IconRight:({className:o,...a})=>i.jsx(ka,{className:ea("size-4",o),...a})},...n})}const mCe=["top","right","bottom","left"],Hf=Math.min,Us=Math.max,xw=Math.round,y1=Math.floor,au=e=>({x:e,y:e}),vCe={left:"right",right:"left",bottom:"top",top:"bottom"};function m6(e,t,r){return Us(e,Hf(t,r))}function wd(e,t){return typeof e=="function"?e(t):e}function Sd(e){return e.split("-")[0]}function Rv(e){return e.split("-")[1]}function c8(e){return e==="x"?"y":"x"}function u8(e){return e==="y"?"height":"width"}function tu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function d8(e){return c8(tu(e))}function yCe(e,t,r){r===void 0&&(r=!1);const n=Rv(e),o=d8(e),a=u8(o);let s=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=bw(s)),[s,bw(s)]}function xCe(e){const t=bw(e);return[v6(e),t,v6(t)]}function v6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const NB=["left","right"],RB=["right","left"],bCe=["top","bottom"],wCe=["bottom","top"];function SCe(e,t,r){switch(e){case"top":case"bottom":return r?t?RB:NB:t?NB:RB;case"left":case"right":return t?bCe:wCe;default:return[]}}function jCe(e,t,r,n){const o=Rv(e);let a=SCe(Sd(e),r==="start",n);return o&&(a=a.map(s=>s+"-"+o),t&&(a=a.concat(a.map(v6)))),a}function bw(e){const t=Sd(e);return vCe[t]+e.slice(t.length)}function kCe(e){return{top:0,right:0,bottom:0,left:0,...e}}function hK(e){return typeof e!="number"?kCe(e):{top:e,right:e,bottom:e,left:e}}function ww(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 LB(e,t,r){let{reference:n,floating:o}=e;const a=tu(t),s=d8(t),l=u8(s),c=Sd(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(Rv(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 _Ce(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}=wd(t,e),v=hK(p),b=l[h?f==="floating"?"reference":"floating":f],x=ww(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(b)))==null||r?b:b.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)),j=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},_=ww(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:c}):w);return{top:(x.top-_.top+v.top)/j.y,bottom:(_.bottom-x.bottom+v.bottom)/j.y,left:(x.left-_.left+v.left)/j.x,right:(_.right-x.right+v.right)/j.x}}const CCe=50,ECe=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:a=[],platform:s}=r,l=s.detectOverflow?s:{...s,detectOverflow:_Ce},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}=LB(u,n,c),h=n,p=0;const v={};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}=wd(e,t)||{};if(u==null)return{};const f=hK(d),h={x:r,y:n},p=d8(o),v=u8(p),m=await s.getDimensions(u),b=p==="y",x=b?"top":"left",w=b?"bottom":"right",k=b?"clientHeight":"clientWidth",j=a.reference[v]+a.reference[p]-h[p]-a.floating[v],_=h[p]-a.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let A=T?T[k]:0;(!A||!await(s.isElement==null?void 0:s.isElement(T)))&&(A=l.floating[k]||a.floating[v]);const P=j/2-_/2,N=A/2-m[v]/2-1,O=Hf(f[x],N),C=Hf(f[w],N),I=O,R=A-m[v]-C,F=A/2-m[v]/2+P,M=m6(I,F,R),Y=!c.arrow&&Rv(o)!=null&&F!==M&&a.reference[v]/2-(FF<=0)){var C,I;const F=(((C=a.flip)==null?void 0:C.index)||0)+1,M=A[F];if(M&&(!(f==="alignment"?w!==tu(M):!1)||O.every($=>tu($.placement)===w?$.overflows[0]>0:!0)))return{data:{index:F,overflows:O},reset:{placement:M}};let Y=(I=O.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:I.placement;if(!Y)switch(p){case"bestFit":{var R;const X=(R=O.filter($=>{if(T){const ee=tu($.placement);return ee===w||ee==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ee=>ee>0).reduce((ee,V)=>ee+V,0)]).sort(($,ee)=>$[1]-ee[1])[0])==null?void 0:R[0];X&&(Y=X);break}case"initialPlacement":Y=l;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function FB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zB(e){return mCe.some(t=>e[t]>=0)}const PCe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:o="referenceHidden",...a}=wd(e,t);switch(o){case"referenceHidden":{const s=await n.detectOverflow(t,{...a,elementContext:"reference"}),l=FB(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zB(l)}}}case"escaped":{const s=await n.detectOverflow(t,{...a,altBoundary:!0}),l=FB(s,r.floating);return{data:{escapedOffsets:l,escaped:zB(l)}}}default:return{}}}}},gK=new Set(["left","top"]);async function ICe(e,t){const{placement:r,platform:n,elements:o}=e,a=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=Sd(r),l=Rv(r),c=tu(r)==="y",u=gK.has(s)?-1:1,d=a&&c?-1:1,f=wd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(p=l==="end"?v*-1:v),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const OCe=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 ICe(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}}}}},NCe=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:x=>{let{x:w,y:k}=x;return{x:w,y:k}}},...u}=wd(e,t),d={x:r,y:n},f=await a.detectOverflow(t,u),h=tu(Sd(o)),p=c8(h);let v=d[p],m=d[h];if(s){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",k=v+f[x],j=v-f[w];v=m6(k,v,j)}if(l){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=m+f[x],j=m-f[w];m=m6(k,m,j)}const b=c.fn({...t,[p]:v,[h]:m});return{...b,data:{x:b.x-r,y:b.y-n,enabled:{[p]:s,[h]:l}}}}}},RCe=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}=wd(e,t),d={x:r,y:n},f=tu(o),h=c8(f);let p=d[h],v=d[f];const m=wd(l,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=h==="y"?"height":"width",j=a.reference[h]-a.floating[k]+b.mainAxis,_=a.reference[h]+a.reference[k]-b.mainAxis;p_&&(p=_)}if(u){var x,w;const k=h==="y"?"width":"height",j=gK.has(Sd(o)),_=a.reference[f]-a.floating[k]+(j&&((x=s.offset)==null?void 0:x[f])||0)+(j?0:b.crossAxis),T=a.reference[f]+a.reference[k]+(j?0:((w=s.offset)==null?void 0:w[f])||0)-(j?b.crossAxis:0);v<_?v=_:v>T&&(v=T)}return{[h]:p,[f]:v}}}},LCe=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}=wd(e,t),d=await s.detectOverflow(t,u),f=Sd(o),h=Rv(o),p=tu(o)==="y",{width:v,height:m}=a.floating;let b,x;f==="top"||f==="bottom"?(b=f,x=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(x=f,b=h==="end"?"top":"bottom");const w=m-d.top-d.bottom,k=v-d.left-d.right,j=Hf(m-d[b],w),_=Hf(v-d[x],k),T=!t.middlewareData.shift;let A=j,P=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(P=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(A=w),T&&!h){const O=Us(d.left,0),C=Us(d.right,0),I=Us(d.top,0),R=Us(d.bottom,0);p?P=v-2*(O!==0||C!==0?O+C:Us(d.left,d.right)):A=m-2*(I!==0||R!==0?I+R:Us(d.top,d.bottom))}await c({...t,availableWidth:P,availableHeight:A});const N=await s.getDimensions(l.floating);return v!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function ej(){return typeof window<"u"}function Lv(e){return mK(e)?(e.nodeName||"").toLowerCase():"#document"}function Qs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pu(e){var t;return(t=(mK(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mK(e){return ej()?e instanceof Node||e instanceof Qs(e).Node:!1}function vc(e){return ej()?e instanceof Element||e instanceof Qs(e).Element:!1}function Nd(e){return ej()?e instanceof HTMLElement||e instanceof Qs(e).HTMLElement:!1}function MB(e){return!ej()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qs(e).ShadowRoot}function Hb(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=yc(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&o!=="inline"&&o!=="contents"}function FCe(e){return/^(table|td|th)$/.test(Lv(e))}function tj(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zCe=/transform|translate|scale|rotate|perspective|filter/,MCe=/paint|layout|strict|content/,Wp=e=>!!e&&e!=="none";let yE;function f8(e){const t=vc(e)?yc(e):e;return Wp(t.transform)||Wp(t.translate)||Wp(t.scale)||Wp(t.rotate)||Wp(t.perspective)||!p8()&&(Wp(t.backdropFilter)||Wp(t.filter))||zCe.test(t.willChange||"")||MCe.test(t.contain||"")}function DCe(e){let t=Vf(e);for(;Nd(t)&&!uv(t);){if(f8(t))return t;if(tj(t))return null;t=Vf(t)}return null}function p8(){return yE==null&&(yE=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yE}function uv(e){return/^(html|body|#document)$/.test(Lv(e))}function yc(e){return Qs(e).getComputedStyle(e)}function rj(e){return vc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vf(e){if(Lv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||MB(e)&&e.host||pu(e);return MB(t)?t.host:t}function vK(e){const t=Vf(e);return uv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nd(t)&&Hb(t)?t:vK(t)}function db(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=vK(e),a=o===((n=e.ownerDocument)==null?void 0:n.body),s=Qs(o);if(a){const l=y6(s);return t.concat(s,s.visualViewport||[],Hb(o)?o:[],l&&r?db(l):[])}else return t.concat(o,db(o,[],r))}function y6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yK(e){const t=yc(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Nd(e),a=o?e.offsetWidth:r,s=o?e.offsetHeight:n,l=xw(r)!==a||xw(n)!==s;return l&&(r=a,n=s),{width:r,height:n,$:l}}function h8(e){return vc(e)?e:e.contextElement}function xm(e){const t=h8(e);if(!Nd(t))return au(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:a}=yK(t);let s=(a?xw(r.width):r.width)/n,l=(a?xw(r.height):r.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const BCe=au(0);function xK(e){const t=Qs(e);return!p8()||!t.visualViewport?BCe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function WCe(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qs(e)?!1:t}function Nh(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),a=h8(e);let s=au(1);t&&(n?vc(n)&&(s=xm(n)):s=xm(e));const l=WCe(a,r,n)?xK(a):au(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&&vc(n)?Qs(n):n;let v=h,m=y6(v);for(;m&&n&&p!==v;){const b=xm(m),x=m.getBoundingClientRect(),w=yc(m),k=x.left+(m.clientLeft+parseFloat(w.paddingLeft))*b.x,j=x.top+(m.clientTop+parseFloat(w.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,f*=b.y,c+=k,u+=j,v=Qs(m),m=y6(v)}}return ww({width:d,height:f,x:c,y:u})}function nj(e,t){const r=rj(e).scrollLeft;return t?t.left+r:Nh(pu(e)).left+r}function bK(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-nj(e,r),o=r.top+t.scrollTop;return{x:n,y:o}}function qCe(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const a=o==="fixed",s=pu(n),l=t?tj(t.floating):!1;if(n===s||l&&a)return r;let c={scrollLeft:0,scrollTop:0},u=au(1);const d=au(0),f=Nd(n);if((f||!f&&!a)&&((Lv(n)!=="body"||Hb(s))&&(c=rj(n)),f)){const p=Nh(n);u=xm(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=s&&!f&&!a?bK(s,c):au(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 $Ce(e){return Array.from(e.getClientRects())}function UCe(e){const t=pu(e),r=rj(e),n=e.ownerDocument.body,o=Us(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=Us(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+nj(e);const l=-r.scrollTop;return yc(n).direction==="rtl"&&(s+=Us(t.clientWidth,n.clientWidth)-o),{width:o,height:a,x:s,y:l}}const DB=25;function HCe(e,t){const r=Qs(e),n=pu(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=p8();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=nj(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,v=Math.abs(n.clientWidth-f.clientWidth-p);v<=DB&&(a-=v)}else u<=DB&&(a+=u);return{width:a,height:s,x:l,y:c}}function VCe(e,t){const r=Nh(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,a=Nd(e)?xm(e):au(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 BB(e,t,r){let n;if(t==="viewport")n=HCe(e,r);else if(t==="document")n=UCe(pu(e));else if(vc(t))n=VCe(t,r);else{const o=xK(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ww(n)}function wK(e,t){const r=Vf(e);return r===t||!vc(r)||uv(r)?!1:yc(r).position==="fixed"||wK(r,t)}function YCe(e,t){const r=t.get(e);if(r)return r;let n=db(e,[],!1).filter(l=>vc(l)&&Lv(l)!=="body"),o=null;const a=yc(e).position==="fixed";let s=a?Vf(e):e;for(;vc(s)&&!uv(s);){const l=yc(s),c=f8(s);!c&&l.position==="fixed"&&(o=null),(a?!c&&!o:!c&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Hb(s)&&!c&&wK(e,s))?n=n.filter(d=>d!==s):o=l,s=Vf(s)}return t.set(e,n),n}function GCe(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const s=[...r==="clippingAncestors"?tj(t)?[]:YCe(t,this._c):[].concat(r),n],l=BB(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)}A===1&&!jK(u,e.getBoundingClientRect())&&s(),j=!1}try{r=new IntersectionObserver(_,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(_,k)}r.observe(e)}return s(!0),a}function t4e(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=h8(e),d=o||a?[...u?db(u):[],...t?db(t):[]]:[];d.forEach(x=>{o&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const f=u&&l?e4e(u,r):null;let h=-1,p=null;s&&(p=new ResizeObserver(x=>{let[w]=x;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 v,m=c?Nh(e):null;c&&b();function b(){const x=Nh(e);m&&!jK(m,x)&&r(),m=x,v=requestAnimationFrame(b)}return r(),()=>{var x;d.forEach(w=>{o&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),f==null||f(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const r4e=OCe,n4e=NCe,i4e=TCe,o4e=LCe,a4e=PCe,qB=ACe,s4e=RCe,l4e=(e,t,r)=>{const n=new Map,o={platform:JCe,...r},a={...o.platform,_c:n};return ECe(e,t,{...o,platform:a})};var c4e=typeof document<"u",u4e=function(){},q1=c4e?S.useLayoutEffect:u4e;function Sw(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(!Sw(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)&&!Sw(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function kK(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $B(e,t){const r=kK(e);return Math.round(t*r)/r}function bE(e){const t=S.useRef(e);return q1(()=>{t.current=e}),t}function d4e(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]=S.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=S.useState(n);Sw(h,n)||p(n);const[v,m]=S.useState(null),[b,x]=S.useState(null),w=S.useCallback($=>{$!==T.current&&(T.current=$,m($))},[]),k=S.useCallback($=>{$!==A.current&&(A.current=$,x($))},[]),j=a||v,_=s||b,T=S.useRef(null),A=S.useRef(null),P=S.useRef(d),N=c!=null,O=bE(c),C=bE(o),I=bE(u),R=S.useCallback(()=>{if(!T.current||!A.current)return;const $={placement:t,strategy:r,middleware:h};C.current&&($.platform=C.current),l4e(T.current,A.current,$).then(ee=>{const V={...ee,isPositioned:I.current!==!1};F.current&&!Sw(P.current,V)&&(P.current=V,iT.flushSync(()=>{f(V)}))})},[h,t,r,C,I]);q1(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const F=S.useRef(!1);q1(()=>(F.current=!0,()=>{F.current=!1}),[]),q1(()=>{if(j&&(T.current=j),_&&(A.current=_),j&&_){if(O.current)return O.current(j,_,R);R()}},[j,_,R,O,N]);const M=S.useMemo(()=>({reference:T,floating:A,setReference:w,setFloating:k}),[w,k]),Y=S.useMemo(()=>({reference:j,floating:_}),[j,_]),X=S.useMemo(()=>{const $={position:r,left:0,top:0};if(!Y.floating)return $;const ee=$B(Y.floating,d.x),V=$B(Y.floating,d.y);return l?{...$,transform:"translate("+ee+"px, "+V+"px)",...kK(Y.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:V}},[r,l,Y.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:R,refs:M,elements:Y,floatingStyles:X}),[d,R,M,Y,X])}const f4e=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?qB({element:n.current,padding:o}).fn(r):{}:n?qB({element:n,padding:o}).fn(r):{}}}},p4e=(e,t)=>{const r=r4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},h4e=(e,t)=>{const r=n4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},g4e=(e,t)=>({fn:s4e(e).fn,options:[e,t]}),m4e=(e,t)=>{const r=i4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},v4e=(e,t)=>{const r=o4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},y4e=(e,t)=>{const r=a4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},x4e=(e,t)=>{const r=f4e(e);return{name:r.name,fn:r.fn,options:[e,t]}};var b4e="Arrow",_K=S.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...a}=e;return i.jsx(_a.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"})})});_K.displayName=b4e;var w4e=_K;function CK(e){const[t,r]=S.useState(void 0);return jh(()=>{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 g8="Popper",[EK,AK]=uS(g8),[S4e,TK]=EK(g8),PK=e=>{const{__scopePopper:t,children:r}=e,[n,o]=S.useState(null);return i.jsx(S4e,{scope:t,anchor:n,onAnchorChange:o,children:r})};PK.displayName=g8;var IK="PopperAnchor",OK=S.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,a=TK(IK,r),s=S.useRef(null),l=zl(t,s);return S.useEffect(()=>{a.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:i.jsx(_a.div,{...o,ref:l})});OK.displayName=IK;var m8="PopperContent",[j4e,k4e]=EK(m8),NK=S.forwardRef((e,t)=>{var K,re,H,ie,de,le;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:v,...m}=e,b=TK(m8,r),[x,w]=S.useState(null),k=zl(t,ke=>w(ke)),[j,_]=S.useState(null),T=CK(j),A=(T==null?void 0:T.width)??0,P=(T==null?void 0:T.height)??0,N=n+(a!=="center"?"-"+a:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},C=Array.isArray(u)?u:[u],I=C.length>0,R={padding:O,boundary:C.filter(C4e),altBoundary:I},{refs:F,floatingStyles:M,placement:Y,isPositioned:X,middlewareData:$}=d4e({strategy:"fixed",placement:N,whileElementsMounted:(...ke)=>t4e(...ke,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[p4e({mainAxis:o+P,alignmentAxis:s}),c&&h4e({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?g4e():void 0,...R}),c&&m4e({...R}),v4e({...R,apply:({elements:ke,rects:ve,availableWidth:se,availableHeight:be})=>{const{width:De,height:ae}=ve.reference,ue=ke.floating.style;ue.setProperty("--radix-popper-available-width",`${se}px`),ue.setProperty("--radix-popper-available-height",`${be}px`),ue.setProperty("--radix-popper-anchor-width",`${De}px`),ue.setProperty("--radix-popper-anchor-height",`${ae}px`)}}),j&&x4e({element:j,padding:l}),E4e({arrowWidth:A,arrowHeight:P}),h&&y4e({strategy:"referenceHidden",...R})]}),[ee,V]=FK(Y),D=qf(v);jh(()=>{X&&(D==null||D())},[X,D]);const z=(K=$.arrow)==null?void 0:K.x,q=(re=$.arrow)==null?void 0:re.y,G=((H=$.arrow)==null?void 0:H.centerOffset)!==0,[U,Q]=S.useState();return jh(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:X?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ie=$.transformOrigin)==null?void 0:ie.x,(de=$.transformOrigin)==null?void 0:de.y].join(" "),...((le=$.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(j4e,{scope:r,placedSide:ee,onArrowChange:_,arrowX:z,arrowY:q,shouldHideArrow:G,children:i.jsx(_a.div,{"data-side":ee,"data-align":V,...m,ref:k,style:{...m.style,animation:X?void 0:"none"}})})})});NK.displayName=m8;var RK="PopperArrow",_4e={top:"bottom",right:"left",bottom:"top",left:"right"},LK=S.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,a=k4e(RK,n),s=_4e[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(w4e,{...o,ref:r,style:{...o.style,display:"block"}})})});LK.displayName=RK;function C4e(e){return e!==null}var E4e=e=>({name:"transformOrigin",options:e,fn(t){var b,x,w;const{placement:r,rects:n,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,d]=FK(r),f={start:"0%",center:"50%",end:"100%"}[d],h=(((x=o.arrow)==null?void 0:x.x)??0)+l/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let v="",m="";return u==="bottom"?(v=s?f:`${h}px`,m=`${-c}px`):u==="top"?(v=s?f:`${h}px`,m=`${n.floating.height+c}px`):u==="right"?(v=`${-c}px`,m=s?f:`${p}px`):u==="left"&&(v=`${n.floating.width+c}px`,m=s?f:`${p}px`),{data:{x:v,y:m}}}});function FK(e){const[t,r="center"]=e.split("-");return[t,r]}var A4e=PK,zK=OK,T4e=NK,P4e=LK,v8="Popover",[MK]=uS(v8,[AK]),Vb=AK(),[I4e,np]=MK(v8),DK=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!1}=e,l=Vb(t),c=S.useRef(null),[u,d]=S.useState(!1),[f=!1,h]=xT({prop:n,defaultProp:o,onChange:a});return i.jsx(A4e,{...l,children:i.jsx(I4e,{scope:t,contentId:F1(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:S.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>d(!0),[]),onCustomAnchorRemove:S.useCallback(()=>d(!1),[]),modal:s,children:r})})};DK.displayName=v8;var BK="PopoverAnchor",O4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(BK,r),a=Vb(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return S.useEffect(()=>(s(),()=>l()),[s,l]),i.jsx(zK,{...a,...n,ref:t})});O4e.displayName=BK;var WK="PopoverTrigger",qK=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(WK,r),a=Vb(r),s=zl(t,o.triggerRef),l=i.jsx(_a.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":YK(o.open),...n,ref:s,onClick:hs(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:i.jsx(zK,{asChild:!0,...a,children:l})});qK.displayName=WK;var y8="PopoverPortal",[N4e,R4e]=MK(y8,{forceMount:void 0}),$K=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,a=np(y8,t);return i.jsx(N4e,{scope:t,forceMount:r,children:i.jsx(Sv,{present:r||a.open,children:i.jsx(ST,{asChild:!0,container:o,children:n})})})};$K.displayName=y8;var dv="PopoverContent",UK=S.forwardRef((e,t)=>{const r=R4e(dv,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,a=np(dv,e.__scopePopover);return i.jsx(Sv,{present:n||a.open,children:a.modal?i.jsx(L4e,{...o,ref:t}):i.jsx(F4e,{...o,ref:t})})});UK.displayName=dv;var L4e=S.forwardRef((e,t)=>{const r=np(dv,e.__scopePopover),n=S.useRef(null),o=zl(t,n),a=S.useRef(!1);return S.useEffect(()=>{const s=n.current;if(s)return $$(s)},[]),i.jsx(jT,{as:dS,allowPinchZoom:!0,children:i.jsx(HK,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hs(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:hs(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:hs(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),F4e=S.forwardRef((e,t)=>{const r=np(dv,e.__scopePopover),n=S.useRef(!1),o=S.useRef(!1);return i.jsx(HK,{...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()}})}),HK=S.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=np(dv,r),p=Vb(r);return R$(),i.jsx(wT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(bT,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:i.jsx(T4e,{"data-state":YK(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)"}})})})}),VK="PopoverClose",z4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(VK,r);return i.jsx(_a.button,{type:"button",...n,ref:t,onClick:hs(e.onClick,()=>o.onOpenChange(!1))})});z4e.displayName=VK;var M4e="PopoverArrow",D4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=Vb(r);return i.jsx(P4e,{...o,...n,ref:t})});D4e.displayName=M4e;function YK(e){return e?"open":"closed"}var B4e=DK,W4e=qK,q4e=$K,$4e=UK;function U4e({...e}){return i.jsx(B4e,{"data-slot":"popover",...e})}function H4e({...e}){return i.jsx(W4e,{"data-slot":"popover-trigger",...e})}function V4e({className:e,align:t="center",sideOffset:r=4,...n}){return i.jsx(q4e,{children:i.jsx($4e,{"data-slot":"popover-content",align:t,sideOffset:r,className:ea("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 UB="eventbuzz_setup_checklist_dismissed",Y4e=["organisation","event","session","team","notifications"];function G4e(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 K4e(e,t){return e.some(r=>String(r._id)!==String(t))}function Q4e(e){return Y4e.every(t=>e[t]===!0)}function X4e(e){const t=String(e||"conference").toLowerCase().replace(/[\s_-]+/g,"");return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function Z4e(e){const t=String(e||"draft").toLowerCase();return{live:"Live",upcoming:"Upcoming",completed:"Completed",draft:"Draft"}[t]||"Draft"}function jw(e){return(typeof e=="string"?new Date(e):e).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}function J4e(e,t){var c,u,d;const r=Z4e(e.status),n=X4e(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 eEe(e){return[{id:"all",name:"All Events",description:"",accent:"var(--chart-1)",events:e.map(n=>J4e(n,"all"))}]}const x8={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"}},tEe={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"}},rEe={bg:"#f1f5f9",color:"#475569"},b8={bg:"#f1f5f9",color:"#475569",label:"Unknown"},w8={Physical:i.jsx(_b,{size:11}),Virtual:i.jsx(Wf,{size:11}),Hybrid:i.jsx(cS,{size:11})};function S8({status:e}){const t=x8[e]??b8;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 j8({type:e}){const t=tEe[e]??rEe;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 GK({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 HB({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 nEe({items:e}){const[t,r]=S.useState(!1),n=S.useRef(null);return S.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($te,{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 KK(e){return e>=1e5?`₹${(e/1e5).toFixed(2)}L`:e>=1e3?`₹${(e/1e3).toFixed(1)}K`:`₹${e}`}function iEe({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(E$,{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 oEe({event:e,accent:t,categoryName:r,onOpen:n}){const[o,a]=S.useState(!1),[s,l]=S.useState("attendance");x8[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(S8,{status:e.status}),i.jsx(j8,{type:e.type}),i.jsx(GK,{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(Vi,{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:[jw(e.startDate),e.endDate!==e.startDate?` – ${jw(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:w8[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(T$,{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?KK(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(iEe,{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(HB,{icon:i.jsx(Ri,{size:11}),value:e.participants>0?e.participants:"—",label:e.participants===1?"participant":"participants"}),i.jsx(HB,{icon:i.jsx(Vi,{size:11}),value:e.sessions>0?e.sessions:"—",label:"sessions"})]})]})}function aEe({event:e,categoryName:t,accent:r,onOpen:n}){const[o,a]=S.useState(!1),[s,l]=S.useState(!1),c=(e.status==="Live"||e.status==="Completed")&&e.registeredAttendees!==void 0;x8[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(Qf,{size:12}):i.jsx(go,{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(j8,{type:e.type}),i.jsx(GK,{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:[jw(e.startDate),e.endDate!==e.startDate?` – ${jw(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:w8[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(S8,{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(bv,{size:11})," Open"]}),i.jsx(nEe,{items:[{label:"Duplicate",icon:i.jsx(Js,{size:13}),onClick:()=>{}},{label:"Edit",icon:i.jsx(wi,{size:13}),onClick:()=>{}},{label:"Delete",icon:i.jsx(Xr,{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(Ri,{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(T$,{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:KK(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(E$,{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 sEe({categories:e,onOpenEvent:t}){const r=new Date,[n,o]=S.useState(new Date(r.getFullYear(),r.getMonth(),1)),[a,s]=S.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=S.useMemo(()=>{const w=new Map;return e.forEach(k=>{k.events.forEach(j=>{const _=new Date(j.startDate),T=new Date(j.endDate),A=new Date(_);let P=0;for(;A<=T&&P<60;){const N=l(A);w.has(N)||w.set(N,[]),w.get(N).push({event:j,category:k}),A.setDate(A.getDate()+1),P++}})}),w},[e]),d=n.getFullYear(),f=n.getMonth(),h=new Date(d,f,1).getDay(),p=new Date(d,f+1,0).getDate(),v=[...Array(h).fill(null),...Array.from({length:p},(w,k)=>k+1)];for(;v.length%7!==0;)v.push(null);const m=["January","February","March","April","May","June","July","August","September","October","November","December"],b=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=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(vd,{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(ka,{size:13})})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",borderBottom:"1px solid var(--border)"},children:b.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:v.map((w,k)=>{const j=k%7,_=k>=v.length-7;if(w===null)return i.jsx("div",{style:{minHeight:"90px",background:"var(--secondary)",borderRightWidth:j<6?"1px":"0",borderRightStyle:"solid",borderRightColor:"var(--border)",borderBottomWidth:_?"0":"1px",borderBottomStyle:"solid",borderBottomColor:"var(--border)"}},`pad-${k}`);const T=l(new Date(d,f,w)),A=u.get(T)||[],P=T===c,N=j===0||j===6;return i.jsxs("div",{style:{minHeight:"90px",padding:"5px",background:N?"var(--secondary)":"var(--card)",borderRightWidth:j<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:P?"var(--primary)":"transparent",color:P?"var(--primary-foreground)":N?"var(--muted)":"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:P?"var(--font-weight-medium)":"var(--font-weight-normal)"},children:w})}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[A.slice(0,3).map(({event:O,category:C})=>i.jsx("button",{title:O.name,onClick:()=>s(I=>(I==null?void 0:I.id)===O.id?null:O),style:{display:"block",width:"100%",textAlign:"left",padding:"2px 5px",borderRadius:"3px",background:(a==null?void 0:a.id)===O.id?C.accent+"30":C.accent+"18",borderLeftWidth:"2px",borderLeftStyle:"solid",borderLeftColor:C.accent,borderTopWidth:"0",borderRightWidth:"0",borderBottomWidth:"0",outlineWidth:(a==null?void 0:a.id)===O.id?"1px":"0",outlineStyle:"solid",outlineColor:C.accent,cursor:"pointer",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.name},O.id)),A.length>3&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",paddingLeft:"4px"},children:["+",A.length-3," more"]})]})]},T)})})]}),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&&x&&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:x.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(S8,{status:a.status}),i.jsx(j8,{type:a.type}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:x.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(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.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:w8[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(Ri,{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(dT,{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(Gt,{size:13})})]})]})]})}function lEe({msg:e,onDone:t}){return S.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(bv,{size:13})," ",e]})}function cEe({onNavigateToEvent:e}){const{user:t}=Mr(),r=Nn(t),{setActiveNav:n,setSelectedEventId:o,setSettingsInitialSection:a,setOpenAgendaSessionPanelOnce:s}=Li(),{theme:l}=a$(),[c,u]=S.useState("card"),[d,f]=S.useState(""),[h,p]=S.useState("All"),[v,m]=S.useState("All"),[b,x]=S.useState("All"),[w,k]=S.useState(!1),[j,_]=S.useState(null),[T,A]=S.useState(void 0),[P,N]=S.useState(!1),[O,C]=S.useState(!1),[I,R]=S.useState([]),[F,M]=S.useState(!0),[Y,X]=S.useState(null),[$,ee]=S.useState(()=>{try{return localStorage.getItem(UB)==="1"}catch{return!1}}),[V,D]=S.useState(null),[z,q]=S.useState([]),[G,U]=S.useState(!1),[Q,K]=S.useState(0),re=S.useMemo(()=>eEe(I),[I]),H=(t==null?void 0:t.role)==="super_admin"||(t==null?void 0:t.role)==="admin",ie=S.useMemo(()=>({organisation:G4e(V),event:I.length>=1,session:Q>=1,team:H?G?!1:K4e(z,(t==null?void 0:t._id)??""):!1,notifications:!!(t!=null&&t.notificationPreferencesSavedAt)}),[V,I.length,Q,H,G,z,t==null?void 0:t._id,t==null?void 0:t.notificationPreferencesSavedAt]);S.useEffect(()=>{var Me;if(!r||F||Y)return;let ae=!1;const ue=(Me=I[0])==null?void 0:Me._id;return(async()=>{var He,xt,st;const Se=cs.get().catch(()=>null),Pe=H?Sx.list():Promise.resolve(null),Ee=ue?ta.list(ue):Promise.resolve(null),[Ae,Ye,rt]=await Promise.all([Se,Pe,Ee]);ae||(D(Ae),H&&Ye?Ye.error?(q([]),U(!0)):(q(((He=Ye.data)==null?void 0:He.users)??[]),U(!1)):(q([]),U(!1)),K(ue&&rt?rt.error?0:((st=(xt=rt.data)==null?void 0:xt.sessions)==null?void 0:st.length)??0:0))})(),()=>{ae=!0}},[r,F,Y,H,I]);const de=S.useCallback(()=>{if(M(!0),X(null),!r){R([]),X((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."),M(!1);return}Lr.list({organization:r}).then(ae=>{var ue;((ue=ae.data)==null?void 0:ue.events)!=null?R(ae.data.events):X(ae.error||"Failed to load events")}).catch(()=>X("Failed to load events")).finally(()=>M(!1))},[r,t==null?void 0:t.role]);S.useEffect(()=>{de()},[de]);const le=S.useMemo(()=>re.flatMap(ae=>ae.events.map(ue=>({ev:ue,cat:ae}))),[re]),ke=S.useMemo(()=>le.filter(({ev:ae,cat:ue})=>{const Me=d.toLowerCase(),Se=!Me||ae.name.toLowerCase().includes(Me)||ae.location.toLowerCase().includes(Me)||(ae.subtitle||"").toLowerCase().includes(Me)||ue.name.toLowerCase().includes(Me),Pe=h==="All"||ae.status===h,Ee=v==="All"||ae.type===v,Ae=b==="All"||ue.id===b;return Se&&Pe&&Ee&&Ae}),[le,d,h,v,b]),ve=ke.length,se=h!=="All"||v!=="All"||b!=="All"||!!d,be=!F&&I.length>0,De=ae=>{e?e(ae.id):_(ae.isCurrent?`You are already viewing ${ae.name}`:`Switching to ${ae.name}…`)};return S.useCallback(()=>{try{localStorage.setItem(UB,"1")}catch{}ee(!0)},[]),S.useCallback(ae=>{var ue;if(ae==="organisation"){a("org"),n("settings");return}if(ae==="event"){C(!0);return}if(ae==="session"){const Me=(ue=I[0])==null?void 0:ue._id;Me?(o(Me),s(!0),n("dashboard")):C(!0);return}if(ae==="team"){n("user-management");return}ae==="notifications"&&(a("notifications"),n("settings"))},[I,n,o,a,s]),r&&!F&&!Y&&!$&&Q4e(ie),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"}),(F||Y||(T==null?void 0:T.from))&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[F?"Loading…":Y||null,(T==null?void 0:T.from)&&i.jsx("span",{style:{marginLeft:F||Y?"8px":0,color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:F||Y?"· filtered by date range":"Filtered by date range"})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs(U4e,{open:P,onOpenChange:N,children:[i.jsx(H4e,{asChild:!0,children:i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"7px 12px",borderRadius:"var(--radius-button)",background:T!=null&&T.from?"var(--accent)":"var(--secondary)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderRightColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderBottomColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderLeftColor:T!=null&&T.from?"var(--primary)":"var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",color:T!=null&&T.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:ae=>{T!=null&&T.from||(ae.currentTarget.style.borderTopColor="var(--ring)",ae.currentTarget.style.borderRightColor="var(--ring)",ae.currentTarget.style.borderBottomColor="var(--ring)",ae.currentTarget.style.borderLeftColor="var(--ring)",ae.currentTarget.style.color="var(--foreground)")},onMouseLeave:ae=>{T!=null&&T.from||(ae.currentTarget.style.borderTopColor="var(--border)",ae.currentTarget.style.borderRightColor="var(--border)",ae.currentTarget.style.borderBottomColor="var(--border)",ae.currentTarget.style.borderLeftColor="var(--border)",ae.currentTarget.style.color="var(--muted)")},children:[i.jsx(Vi,{size:13,style:{flexShrink:0}}),T!=null&&T.from?i.jsxs("span",{children:[T.from.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),T.to&&T.to.getTime()!==T.from.getTime()?` – ${T.to.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}`:""]}):i.jsx("span",{children:"Select date range"}),T!=null&&T.from?i.jsx("span",{onClick:ae=>{ae.stopPropagation(),A(void 0)},style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"2px",cursor:"pointer",color:"var(--muted)"},onMouseEnter:ae=>{ae.currentTarget.style.color="var(--destructive)"},onMouseLeave:ae=>{ae.currentTarget.style.color="var(--muted)"},children:i.jsx(Gt,{size:11})}):i.jsx(go,{size:11,style:{flexShrink:0}})]})}),i.jsxs(V4e,{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(ae=>{var Pe,Ee;const ue=new Date,Me=new Date;Me.setDate(Me.getDate()-ae.days);const Se=((Pe=T==null?void 0:T.from)==null?void 0:Pe.toDateString())===Me.toDateString()&&((Ee=T==null?void 0:T.to)==null?void 0:Ee.toDateString())===ue.toDateString();return i.jsx("button",{onClick:()=>{A({from:Me,to:ue}),N(!1)},style:{padding:"3px 10px",borderRadius:"999px",background:Se?"var(--primary)":"var(--secondary)",borderWidth:"1px",borderStyle:"solid",borderColor:Se?"var(--primary)":"var(--border)",color:Se?"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:Ae=>{Se||(Ae.currentTarget.style.borderColor="var(--primary)",Ae.currentTarget.style.color="var(--primary)")},onMouseLeave:Ae=>{Se||(Ae.currentTarget.style.borderColor="var(--border)",Ae.currentTarget.style.color="var(--card-foreground)")},children:ae.label},ae.label)})}),i.jsx(gCe,{mode:"range",selected:T,onSelect:A,numberOfMonths:2,defaultMonth:(()=>{const ae=new Date;return ae.setMonth(ae.getMonth()-1),ae})(),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:()=>{A(void 0),N(!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:ae=>{ae.currentTarget.style.borderColor="var(--ring)"},onMouseLeave:ae=>{ae.currentTarget.style.borderColor="var(--border)"},children:"Clear"}),i.jsx("button",{onClick:()=>N(!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:()=>C(!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(gr,{size:14})," Create Event"]})]})]}),F&&i.jsx(_h,{message:"Loading events…"}),!F&&Y&&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:Y}),i.jsx("button",{type:"button",onClick:()=>de(),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"})]}),!F&&!Y&&!be&&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:()=>C(!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(gr,{size:16})," Create your first event"]})]}),!F&&!Y&&be&&i.jsxs($e.Fragment,{children:[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:ae=>f(ae.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(Gt,{size:12})})]}),i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[i.jsxs("select",{value:h,onChange:ae=>p(ae.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(ae=>i.jsx("option",{value:ae,children:ae},ae))]}),i.jsx(go,{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:v,onChange:ae=>m(ae.target.value),style:{height:"34px",paddingLeft:"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:v!=="All"?"var(--accent)":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:v!=="All"?"var(--primary)":"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:v!=="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(ae=>i.jsx("option",{value:ae,children:ae},ae))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:v!=="All"?"var(--primary)":"var(--muted)"}})]}),(()=>{const ae=b!=="All"?re.find(ue=>ue.id===b):null;return i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[ae&&i.jsx("span",{style:{position:"absolute",left:"10px",width:"7px",height:"7px",borderRadius:"50%",background:ae.accent,flexShrink:0,zIndex:1,pointerEvents:"none"}}),i.jsxs("select",{value:b,onChange:ue=>x(ue.target.value),style:{height:"34px",paddingLeft:ae?"24px":"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:ae?ae.accent+"18":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:ae?ae.accent:"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:ae?ae.accent:"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"120px"},children:[i.jsx("option",{value:"All",children:"Category"}),re.map(ue=>i.jsx("option",{value:ue.id,children:ue.name},ue.id))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:ae?ae.accent:"var(--muted)"}})]})})(),se&&i.jsxs("button",{onClick:()=>{f(""),p("All"),m("All"),x("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(Gt,{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(ae=>i.jsxs("button",{onClick:()=>u(ae),style:{display:"flex",alignItems:"center",gap:"4px",padding:"5px 10px",background:c===ae?"var(--primary)":"transparent",color:c===ae?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:ae!=="card"?"1px solid var(--border)":"none"},children:[ae==="card"?i.jsx(Cb,{size:13}):ae==="list"?i.jsx(Eb,{size:13}):i.jsx(Vi,{size:13}),ae==="card"?"Cards":ae==="list"?"List":"Calendar"]},ae))})})]})}),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:ve})," event",ve!==1?"s":"",se&&i.jsx("span",{style:{color:"var(--primary)",marginLeft:"6px"},children:"· filtered"})]}),c==="calendar"?i.jsx(sEe,{categories:re,onOpenEvent:De}):ke.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"),x("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(Gt,{size:12})," Clear all filters"]})]}):c==="card"?i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(288px, 1fr))",gap:"14px"},children:ke.map(({ev:ae,cat:ue})=>i.jsx(oEe,{event:ae,accent:ue.accent,categoryName:ue.name,onOpen:()=>De(ae)},ae.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((ae,ue)=>i.jsx("th",{style:{padding:ue===0?"8px 8px 8px 12px":"8px 12px",textAlign:ae==="Participants"||ae==="Sessions"?"right":"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap"},children:ae},ue))})}),i.jsx("tbody",{children:ke.map(({ev:ae,cat:ue})=>i.jsx(aEe,{event:ae,categoryName:ue.name,accent:ue.accent,onOpen:()=>De(ae)},ae.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"})})]}),j&&i.jsx(lEe,{msg:j,onDone:()=>_(null)}),O&&i.jsx(GG,{organizationId:r,onClose:()=>{C(!1),de()},onCreated:ae=>{e==null||e(ae)}})]})}function uEe(e,t){return hS(e,t)}function dEe(e){return e==="quiz"?"Quiz":e==="poll"?"Poll":"Q&A Session"}function fEe(e){const t=(e||"draft").toLowerCase();return t==="live"?"Active":t==="upcoming"?"Scheduled":t==="completed"?"Completed":"Draft"}function pEe(e){if(!e)return"—";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return"—"}}const qp={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 VB(e,t,r,n,o){var v,m,b;const a=m2(n),s=m2(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 Lr.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||!((v=u.data)!=null&&v._id))return{ok:!1,error:u.error||"Could not create activity."};const d=u.data._id,p=(b=(((m=(await ta.list(d)).data)==null?void 0:m.sessions)??[])[0])==null?void 0:b._id;return p?{ok:!0,eventId:d,sessionId:p}:{ok:!1,error:"Activity created but no session was found."}}function hEe(e){var r,n;const t=e.activityStats;return{id:e._id,name:e.name,type:dEe(e.activitySubtype),status:fEe(e.status),createdDate:pEe(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 QK={"Q&A Session":{bg:"#E8EFFC",fg:"#0B4DD1",icon:i.jsx($h,{size:14})},Quiz:{bg:"#FEF3C7",fg:"#D97706",icon:i.jsx(tS,{size:14})},Poll:{bg:"#ECFDF5",fg:"#059669",icon:i.jsx(pT,{size:14})}},XK={Active:{bg:"#dcfce7",color:"#15803d"},Scheduled:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}};function YB({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(Gt,{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 gEe({onNavigateToActivity:e}){const{user:t}=Mr(),r=Nn(t),[n,o]=S.useState("card"),[a,s]=S.useState(""),[l,c]=S.useState("all"),[u,d]=S.useState("all"),[f,h]=S.useState(!1),[p,v]=S.useState([]),[m,b]=S.useState(!0),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState("shell"),[N,O]=S.useState("poll"),[C,I]=S.useState(""),[R,F]=S.useState(""),[M,Y]=S.useState(""),[X,$]=S.useState(!1),[ee,V]=S.useState(null),[D,z]=S.useState(null),[q,G]=S.useState(null),[U,Q]=S.useState(!1),[K,re]=S.useState(null),[H,ie]=S.useState(null),de=Si(),le=de==="mobile",ke=de==="mobile"?"1fr":"repeat(4, minmax(0, 1fr))",ve=S.useCallback(async()=>{var Ye;if(!r){v([]),b(!1);return}b(!0),w(null);const Ae=await Lr.list({organization:r,recordKind:"activity",enrich:!0,limit:200});if(b(!1),Ae.error||!((Ye=Ae.data)!=null&&Ye.events)){w(Ae.error||"Could not load activities."),v([]);return}v(Ae.data.events.map(hEe))},[r]);S.useEffect(()=>{ve()},[ve]);const se=()=>{const{start:Ae,end:Ye}=cR();I(""),F(Ae),Y(Ye),re(null),j(!0)},be=()=>{const{start:Ae,end:Ye}=cR();I(""),F(Ae),Y(Ye),O("poll"),V(null),P("shell"),z(null),G(null),T(!0)},De=()=>{T(!1),P("shell"),z(null),G(null),V(null),ie(null)},ae=S.useMemo(()=>{if(A!=="form")return;const Ae=qT();return Ae.title=C.trim(),Ae.status="Draft",Ae.displayMode="always_sched",Ae.scheduledStart=R,Ae.scheduledEnd=M,{form:Ae,questions:[]}},[A,C,R,M]),ue=()=>{(async()=>{if(!r)return;re(null);const Ae=C.trim();if(Ae.length<3){re("Name must be at least 3 characters.");return}Q(!0);const Ye=await VB(r,Ae,"qna",R,M);if(Q(!1),!Ye.ok){re(Ye.error);return}j(!1),ve(),e==null||e(Ye.eventId)})()},Me=()=>{(async()=>{if(!r)return;V(null);const Ae=C.trim();if(Ae.length<3){V("Name must be at least 3 characters.");return}$(!0);const Ye=await VB(r,Ae,N,R,M);if($(!1),!Ye.ok){V(Ye.error);return}z(Ye.eventId),G(Ye.sessionId),ie(null),P("form")})()},Se=Ae=>{(async()=>{if(!D||!q)return;const Ye=N;ie(null);const rt={session:q,title:Ae.form.title,type:Ye,description:Ae.form.description||void 0,questions:Ae.questions.map(xt=>uEe(xt,Ye)),settings:gS(Ae.form,Ye)},He=await Pi.create(D,rt);if(He.error){ie(He.error);return}De(),ve(),e==null||e(D)})()},Pe=S.useMemo(()=>p.filter(Ae=>{var xt;const Ye=a===""||Ae.name.toLowerCase().includes(a.toLowerCase())||(((xt=Ae.subtitle)==null?void 0:xt.toLowerCase().includes(a.toLowerCase()))??!1),rt=l==="all"||Ae.type===l,He=u==="all"||Ae.status===u;return Ye&&rt&&He}),[p,a,l,u]),Ee=S.useMemo(()=>{const Ae=p;return{count:Ae.length,active:Ae.filter(Ye=>Ye.status==="Active").length,participants:Ae.reduce((Ye,rt)=>Ye+rt.participants,0),responses:Ae.reduce((Ye,rt)=>Ye+rt.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:le?"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&&se(),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($h,{size:14})," Create Q&A Session"]}),i.jsxs("button",{type:"button",onClick:()=>r&&be(),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(pT,{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."}),x&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:0},children:x}),m&&r?i.jsx(_h,{message:"Loading activities…"}):null,!m&&r?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:le?"1fr 1fr":"repeat(4, 1fr)",gap:"12px"},children:[i.jsx(x1,{label:"Total Activities",value:String(Ee.count)}),i.jsx(x1,{label:"Active",value:String(Ee.active),color:"#15803d"}),i.jsx(x1,{label:"Total Participants",value:String(Ee.participants)}),i.jsx(x1,{label:"Total Responses",value:String(Ee.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:le?"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:Ae=>s(Ae.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(Gt,{size:12})}):null]}),i.jsxs("select",{value:l,onChange:Ae=>c(Ae.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:Ae=>d(Ae.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(Cb,{size:14}),label:"Cards"},{mode:"list",icon:i.jsx(Eb,{size:14}),label:"List"},{mode:"calendar",icon:i.jsx(Vi,{size:14}),label:"Calendar"}].map(Ae=>i.jsx("button",{type:"button",onClick:()=>o(Ae.mode),title:Ae.label,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"28px",borderRadius:"var(--radius-button)",background:n===Ae.mode?"var(--card)":"transparent",color:n===Ae.mode?"var(--primary)":"var(--muted)",border:"none",cursor:"pointer",transition:"all 0.15s"},children:Ae.icon},Ae.mode))})]}),i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",Pe.length," ",Pe.length===1?"activity":"activities"]}),n==="card"&&i.jsx("div",{style:{display:"grid",gridTemplateColumns:ke,gap:"16px"},children:Pe.map(Ae=>i.jsx(mEe,{activity:Ae,onClick:()=>e==null?void 0:e(Ae.id)},Ae.id))}),n==="list"&&i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",overflow:"hidden"},children:Pe.map((Ae,Ye)=>i.jsx(vEe,{activity:Ae,isLast:Ye===Pe.length-1,onClick:()=>e==null?void 0:e(Ae.id)},Ae.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(Vi,{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"})]}),Pe.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(YB,{title:"Create Q&A Session",subtitle:"Name is used for the event and the session. Track: Default.",onClose:()=>{j(!1),re(null)},footer:i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:()=>{j(!1),re(null)},disabled:U,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:U?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:ue,disabled:U,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:U?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:U?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:U?"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:C,onChange:Ae=>I(Ae.target.value),disabled:U,placeholder:"e.g. Keynote Q&A",style:{...qp,marginBottom:"16px"}}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:le?"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(Pf,{value:R,onChange:F,style:qp,disabled:U})]}),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(Pf,{value:M,onChange:Y,style:qp,disabled:U})]})]}),K?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:K}):null]})}):null,_&&r?i.jsx(YB,{title:A==="shell"?"Create Quiz / Poll":N==="quiz"?"New quiz":"New poll",subtitle:A==="shell"?"Step 1: name and schedule (event & session; track: Default). Step 2: same form as Quiz & Polls in the event dashboard.":void 0,onClose:De,footer:A==="shell"?i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:De,disabled:X,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:X?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:Me,disabled:X,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:X?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:X?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:X?"Creating…":"Continue to form"})]}):void 0,children:A==="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:C,onChange:Ae=>I(Ae.target.value),disabled:X,placeholder:"e.g. Audience pulse check",style:{...qp,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:N,onChange:Ae=>O(Ae.target.value),disabled:X,style:{...qp,marginBottom:"16px",cursor:X?"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:le?"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(Pf,{value:R,onChange:F,style:qp,disabled:X})]}),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(Pf,{value:M,onChange:Y,style:qp,disabled:X})]})]}),ee?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:ee}):null]}):D&&ae?i.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[H?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:H}):null,i.jsx(Ax,{variant:"panel",kind:N,eventId:D,initial:ae,onClose:De,onSave:Se},`${D}-${N}`)]}):null}):null]})}function x1({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 mEe({activity:e,onClick:t}){const r=QK[e.type],n=XK[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(Ri,{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(tS,{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(yv,{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 vEe({activity:e,isLast:t,onClick:r}){const n=QK[e.type],o=XK[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 yEe=()=>{};var GB={};/** - * @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 ZK={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 $t=function(e,t){if(!e)throw Fv(t)},Fv=function(e){return new Error("Firebase Database ("+ZK.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 JK=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},xEe=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("")},k8={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(JK(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):xEe(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 v=u<<6&192|f;n.push(v)}}}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 bEe extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const eQ=function(e){const t=JK(e);return k8.encodeByteArray(t,!0)},kw=function(e){return eQ(e).replace(/\./g,"")},x6=function(e){try{return k8.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 wEe(e){return tQ(void 0,e)}function tQ(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)||!SEe(r)||(e[r]=tQ(e[r],t[r]));return e}function SEe(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 jEe(){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 kEe=()=>jEe().__FIREBASE_DEFAULTS__,_Ee=()=>{if(typeof process>"u"||typeof GB>"u")return;const e=GB.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},CEe=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&x6(e[1]);return t&&JSON.parse(t)},rQ=()=>{try{return yEe()||kEe()||_Ee()||CEe()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},EEe=e=>{var t,r;return(r=(t=rQ())===null||t===void 0?void 0:t.emulatorHosts)===null||r===void 0?void 0:r[e]},AEe=e=>{const t=EEe(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]},nQ=()=>{var e;return(e=rQ())===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 _8{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 C8(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function TEe(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 PEe(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[kw(JSON.stringify(r)),kw(JSON.stringify(s)),""].join(".")}const ux={};function IEe(){const e={prod:[],emulator:[]};for(const t of Object.keys(ux))ux[t]?e.emulator.push(t):e.prod.push(t);return e}function OEe(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 KB=!1;function NEe(e,t){if(typeof window>"u"||typeof document>"u"||!C8(window.location.host)||ux[e]===t||ux[e]||KB)return;ux[e]=t;function r(h){return`__firebase__banner__${h}`}const n="__firebase__banner",a=IEe().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=()=>{KB=!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=OEe(n),p=r("text"),v=document.getElementById(p)||document.createElement("span"),m=r("learnmore"),b=document.getElementById(m)||document.createElement("a"),x=r("preprendIcon"),w=document.getElementById(x)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(h.created){const k=h.element;l(k),d(b,m);const j=u();c(w,x),k.append(w,v,b,j),document.body.appendChild(k)}a?(v.innerText="Preview backend disconnected.",w.innerHTML=` - - - - - - -`):(w.innerHTML=` - - - - - - -`,v.innerText="Preview backend running in this workspace."),v.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 REe(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iQ(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(REe())}function LEe(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function FEe(){return ZK.NODE_ADMIN===!0}function zEe(){try{return typeof indexedDB=="object"}catch{return!1}}function MEe(){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 DEe="FirebaseError";class Yb extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=DEe,Object.setPrototypeOf(this,Yb.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,oQ.prototype.create)}}class oQ{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?BEe(a,n):"Error",l=`${this.serviceName}: ${s} (${o}).`;return new Yb(o,l,n)}}function BEe(e,t){return e.replace(WEe,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const WEe=/\{\$([^}]+)}/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 fb(e){return JSON.parse(e)}function zo(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 aQ=function(e){let t={},r={},n={},o="";try{const a=e.split(".");t=fb(x6(a[0])||""),r=fb(x6(a[1])||""),o=a[2],n=r.d||{},delete r.d}catch{}return{header:t,claims:r,data:n,signature:o}},qEe=function(e){const t=aQ(e),r=t.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},$Ee=function(e){const t=aQ(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 Rd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fv(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function QB(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function _w(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 Cw(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(XB(a)&&XB(s)){if(!Cw(a,s))return!1}else if(a!==s)return!1}for(const o of n)if(!r.includes(o))return!1;return!0}function XB(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 UEe(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 HEe{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 sQ(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 VEe=function(e){const t=[];let r=0;for(let n=0;n=55296&&o<=56319){const a=o-55296;n++,$t(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},ij=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 oj(e){return e&&e._delegate?e._delegate:e}class pb{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 Jp="[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 YEe{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 _8;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(KEe(t))try{this.getOrInitializeService({instanceIdentifier:Jp})}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=Jp){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=Jp){return this.instances.has(t)}getOptions(t=Jp){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:GEe(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=Jp){return this.component?this.component.multipleInstances?t:Jp:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function GEe(e){return e===Jp?void 0:e}function KEe(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 QEe{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 YEe(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 Kn;(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"})(Kn||(Kn={}));const XEe={debug:Kn.DEBUG,verbose:Kn.VERBOSE,info:Kn.INFO,warn:Kn.WARN,error:Kn.ERROR,silent:Kn.SILENT},ZEe=Kn.INFO,JEe={[Kn.DEBUG]:"log",[Kn.VERBOSE]:"log",[Kn.INFO]:"info",[Kn.WARN]:"warn",[Kn.ERROR]:"error"},e3e=(e,t,...r)=>{if(tt.some(r=>e instanceof r);let ZB,JB;function r3e(){return ZB||(ZB=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function n3e(){return JB||(JB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const cQ=new WeakMap,b6=new WeakMap,uQ=new WeakMap,wE=new WeakMap,E8=new WeakMap;function i3e(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",a),e.removeEventListener("error",s)},a=()=>{r(Mf(e.result)),o()},s=()=>{n(e.error),o()};e.addEventListener("success",a),e.addEventListener("error",s)});return t.then(r=>{r instanceof IDBCursor&&cQ.set(r,e)}).catch(()=>{}),E8.set(t,e),t}function o3e(e){if(b6.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)});b6.set(e,t)}let w6={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return b6.get(e);if(t==="objectStoreNames")return e.objectStoreNames||uQ.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Mf(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 a3e(e){w6=e(w6)}function s3e(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(SE(this),t,...r);return uQ.set(n,t.sort?t.sort():[t]),Mf(n)}:n3e().includes(e)?function(...t){return e.apply(SE(this),t),Mf(cQ.get(this))}:function(...t){return Mf(e.apply(SE(this),t))}}function l3e(e){return typeof e=="function"?s3e(e):(e instanceof IDBTransaction&&o3e(e),t3e(e,r3e())?new Proxy(e,w6):e)}function Mf(e){if(e instanceof IDBRequest)return i3e(e);if(wE.has(e))return wE.get(e);const t=l3e(e);return t!==e&&(wE.set(e,t),E8.set(t,e)),t}const SE=e=>E8.get(e);function c3e(e,t,{blocked:r,upgrade:n,blocking:o,terminated:a}={}){const s=indexedDB.open(e,t),l=Mf(s);return n&&s.addEventListener("upgradeneeded",c=>{n(Mf(s.result),c.oldVersion,c.newVersion,Mf(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 u3e=["get","getKey","getAll","getAllKeys","count"],d3e=["put","add","delete","clear"],jE=new Map;function e9(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(jE.get(t))return jE.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=d3e.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||u3e.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 jE.set(t,a),a}a3e(e=>({...e,get:(t,r,n)=>e9(t,r)||e.get(t,r,n),has:(t,r)=>!!e9(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 f3e{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(p3e(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function p3e(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const S6="@firebase/app",t9="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 jd=new lQ("@firebase/app"),h3e="@firebase/app-compat",g3e="@firebase/analytics-compat",m3e="@firebase/analytics",v3e="@firebase/app-check-compat",y3e="@firebase/app-check",x3e="@firebase/auth",b3e="@firebase/auth-compat",w3e="@firebase/database",S3e="@firebase/data-connect",j3e="@firebase/database-compat",k3e="@firebase/functions",_3e="@firebase/functions-compat",C3e="@firebase/installations",E3e="@firebase/installations-compat",A3e="@firebase/messaging",T3e="@firebase/messaging-compat",P3e="@firebase/performance",I3e="@firebase/performance-compat",O3e="@firebase/remote-config",N3e="@firebase/remote-config-compat",R3e="@firebase/storage",L3e="@firebase/storage-compat",F3e="@firebase/firestore",z3e="@firebase/ai",M3e="@firebase/firestore-compat",D3e="firebase",B3e="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 j6="[DEFAULT]",W3e={[S6]:"fire-core",[h3e]:"fire-core-compat",[m3e]:"fire-analytics",[g3e]:"fire-analytics-compat",[y3e]:"fire-app-check",[v3e]:"fire-app-check-compat",[x3e]:"fire-auth",[b3e]:"fire-auth-compat",[w3e]:"fire-rtdb",[S3e]:"fire-data-connect",[j3e]:"fire-rtdb-compat",[k3e]:"fire-fn",[_3e]:"fire-fn-compat",[C3e]:"fire-iid",[E3e]:"fire-iid-compat",[A3e]:"fire-fcm",[T3e]:"fire-fcm-compat",[P3e]:"fire-perf",[I3e]:"fire-perf-compat",[O3e]:"fire-rc",[N3e]:"fire-rc-compat",[R3e]:"fire-gcs",[L3e]:"fire-gcs-compat",[F3e]:"fire-fst",[M3e]:"fire-fst-compat",[z3e]:"fire-vertex","fire-js":"fire-js",[D3e]:"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 hb=new Map,q3e=new Map,k6=new Map;function r9(e,t){try{e.container.addComponent(t)}catch(r){jd.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Ew(e){const t=e.name;if(k6.has(t))return jd.debug(`There were multiple attempts to register component ${t}.`),!1;k6.set(t,e);for(const r of hb.values())r9(r,e);for(const r of q3e.values())r9(r,e);return!0}function $3e(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function U3e(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 H3e={"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."},Df=new oQ("app","Firebase",H3e);/** - * @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 V3e{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 pb("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 Df.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 Y3e=B3e;function dQ(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n=Object.assign({name:j6,automaticDataCollectionEnabled:!0},t),o=n.name;if(typeof o!="string"||!o)throw Df.create("bad-app-name",{appName:String(o)});if(r||(r=nQ()),!r)throw Df.create("no-options");const a=hb.get(o);if(a){if(Cw(r,a.options)&&Cw(n,a.config))return a;throw Df.create("duplicate-app",{appName:o})}const s=new QEe(o);for(const c of k6.values())s.addComponent(c);const l=new V3e(r,n,s);return hb.set(o,l),l}function G3e(e=j6){const t=hb.get(e);if(!t&&e===j6&&nQ())return dQ();if(!t)throw Df.create("no-app",{appName:e});return t}function n9(){return Array.from(hb.values())}function bm(e,t,r){var n;let o=(n=W3e[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 "/")`),jd.warn(l.join(" "));return}Ew(new pb(`${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 K3e="firebase-heartbeat-database",Q3e=1,gb="firebase-heartbeat-store";let kE=null;function fQ(){return kE||(kE=c3e(K3e,Q3e,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(gb)}catch(r){console.warn(r)}}}}).catch(e=>{throw Df.create("idb-open",{originalErrorMessage:e.message})})),kE}async function X3e(e){try{const r=(await fQ()).transaction(gb),n=await r.objectStore(gb).get(pQ(e));return await r.done,n}catch(t){if(t instanceof Yb)jd.warn(t.message);else{const r=Df.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});jd.warn(r.message)}}}async function i9(e,t){try{const n=(await fQ()).transaction(gb,"readwrite");await n.objectStore(gb).put(t,pQ(e)),await n.done}catch(r){if(r instanceof Yb)jd.warn(r.message);else{const n=Df.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});jd.warn(n.message)}}}function pQ(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 Z3e=1024,J3e=30;class eAe{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new rAe(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=o9();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>J3e){const s=nAe(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){jd.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=o9(),{heartbeatsToSend:n,unsentEntries:o}=tAe(this._heartbeatsCache.heartbeats),a=kw(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 jd.warn(r),""}}}function o9(){return new Date().toISOString().substring(0,10)}function tAe(e,t=Z3e){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),a9(r)>t){a.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),a9(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class rAe{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return zEe()?MEe().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await X3e(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 i9(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 i9(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...t.heartbeats]})}else return}}function a9(e){return kw(JSON.stringify({version:2,heartbeats:e})).length}function nAe(e){if(e.length===0)return-1;let t=0,r=e[0].date;for(let n=1;nnew f3e(t),"PRIVATE")),Ew(new pb("heartbeat",t=>new eAe(t),"PRIVATE")),bm(S6,t9,e),bm(S6,t9,"esm2017"),bm("fire-js","")}iAe("");var s9={};const l9="@firebase/database",c9="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 hQ="";function oAe(e){hQ=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 aAe{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),zo(r))}get(t){const r=this.domStorage_.getItem(this.prefixedName_(t));return r==null?null:fb(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 sAe{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,r){r==null?delete this.cache_[t]:this.cache_[t]=r}get(t){return Rd(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 gQ=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 aAe(t)}}catch{}return new sAe},fh=gQ("localStorage"),lAe=gQ("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 wm=new lQ("@firebase/database"),cAe=(function(){let e=1;return function(){return e++}})(),mQ=function(e){const t=VEe(e),r=new HEe;r.update(t);const n=r.digest();return k8.encodeByteArray(n)},Gb=function(...e){let t="";for(let r=0;r{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},pv="[MIN_NAME]",Rh="[MAX_NAME]",zv=function(e,t){if(e===t)return 0;if(e===pv||t===Rh)return-1;if(t===pv||e===Rh)return 1;{const r=d9(e),n=d9(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 ms(e,t){for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])}const xQ=function(e){$t(!vQ(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()},hAe=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},gAe=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function mAe(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 vAe=new RegExp("^-?(0*)\\d{1,10}$"),yAe=-2147483648,xAe=2147483647,d9=function(e){if(vAe.test(e)){const t=Number(e);if(t>=yAe&&t<=xAe)return t}return null},Qb=function(e){try{e()}catch(t){setTimeout(()=>{const r=t.stack||"";throw Xs("Exception was thrown by user callback.",r),t},Math.floor(0))}},bAe=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},fx=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 wAe{constructor(t,r){this.appCheckProvider=r,this.appName=t.name,U3e(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 SAe{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"?(xa("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 $1{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}$1.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 T8="5",bQ="v",wQ="s",SQ="r",jQ="f",kQ=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,_Q="ls",CQ="p",C6="ac",EQ="websocket",AQ="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 TQ{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=fh.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()&&fh.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 jAe(e){return e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams}function PQ(e,t,r){$t(typeof t=="string","typeof type must == string"),$t(typeof r=="object","typeof params must == object");let n;if(t===EQ)n=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===AQ)n=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+t);jAe(e)&&(r.ns=e.namespace);const o=[];return ms(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 kAe{constructor(){this.counters_={}}incrementCounter(t,r=1){Rd(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=r}get(){return wEe(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 _E={},CE={};function P8(e){const t=e.toString();return _E[t]||(_E[t]=new kAe),_E[t]}function _Ae(e,t){const r=e.toString();return CE[r]||(CE[r]=t()),CE[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 CAe{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 f9="start",EAe="close",AAe="pLPCommand",TAe="pRTLPCB",IQ="id",OQ="pw",NQ="ser",PAe="cb",IAe="seg",OAe="ts",NAe="d",RAe="dframe",RQ=1870,LQ=30,LAe=RQ-LQ,FAe=25e3,zAe=3e4;class lm{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_=Kb(t),this.stats_=P8(r),this.urlFn=c=>(this.appCheckToken&&(c[C6]=this.appCheckToken),PQ(r,AQ,c))}open(t,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new CAe(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(zAe)),fAe(()=>{if(this.isClosed_)return;this.scriptTagHolder=new I8((...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===f9)this.id=l,this.password=c;else if(s===EAe)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[f9]="t",n[NQ]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(n[PAe]=this.scriptTagHolder.uniqueCallbackIdentifier),n[bQ]=T8,this.transportSessionId&&(n[wQ]=this.transportSessionId),this.lastSessionId&&(n[_Q]=this.lastSessionId),this.applicationId&&(n[CQ]=this.applicationId),this.appCheckToken&&(n[C6]=this.appCheckToken),typeof location<"u"&&location.hostname&&kQ.test(location.hostname)&&(n[SQ]=jQ);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(){lm.forceAllow_=!0}static forceDisallow(){lm.forceDisallow_=!0}static isAvailable(){return lm.forceAllow_?!0:!lm.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!hAe()&&!gAe()}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=zo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=eQ(r),o=yQ(n,LAe);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){xa("frame writing exception"),l.stack&&xa(l.stack),xa(l)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",document.body){document.body.appendChild(t);try{t.contentWindow.document||xa("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[IQ]=this.myID,t[OQ]=this.myPW,t[NQ]=this.currentSerial;let r=this.urlFn(t),n="",o=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+LQ+n.length<=RQ;){const s=this.pendingSegs.shift();n=n+"&"+IAe+o+"="+s.seg+"&"+OAe+o+"="+s.ts+"&"+NAe+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(FAe)),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=()=>{xa("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 MAe=16384,DAe=45e3;let Aw=null;typeof MozWebSocket<"u"?Aw=MozWebSocket:typeof WebSocket<"u"&&(Aw=WebSocket);class ac{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_=Kb(this.connId),this.stats_=P8(r),this.connURL=ac.connectionURL_(r,s,l,o,n),this.nodeAdmin=r.nodeAdmin}static connectionURL_(t,r,n,o,a){const s={};return s[bQ]=T8,typeof location<"u"&&location.hostname&&kQ.test(location.hostname)&&(s[SQ]=jQ),r&&(s[wQ]=r),n&&(s[_Q]=n),o&&(s[C6]=o),a&&(s[CQ]=a),PQ(t,EQ,s)}open(t,r){this.onDisconnect=r,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,fh.set("previous_websocket_failure",!0);try{let n;FEe(),this.mySock=new Aw(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(){ac.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&&Aw!==null&&!ac.forceDisallow_}static previouslyFailed(){return fh.isInMemoryStorage||fh.get("previous_websocket_failure")===!0}markConnectionHealthy(){fh.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=fb(r);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if($t(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=zo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=yQ(r,MAe);n.length>1&&this.sendString_(String(n.length));for(let o=0;o{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(DAe))}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)}}}ac.responsesRequiredToBeHealthy=2;ac.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 mb{static get ALL_TRANSPORTS(){return[lm,ac]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(t){this.initTransports_(t)}initTransports_(t){const r=ac&&ac.isAvailable();let n=r&&!ac.previouslyFailed();if(t.webSocketOnly&&(r||Xs("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[ac];else{const o=this.transports_=[];for(const a of mb.ALL_TRANSPORTS)a&&a.isAvailable()&&o.push(a);mb.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}}mb.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 BAe=6e4,WAe=5e3,qAe=10*1024,$Ae=100*1024,EE="t",p9="d",UAe="s",h9="r",HAe="e",g9="o",m9="a",v9="n",y9="p",VAe="h";class YAe{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_=Kb("c:"+this.id+":"),this.transportManager_=new mb(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_=fx(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>$Ae?(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>qAe?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(EE in t){const r=t[EE];r===m9?this.upgradeIfSecondaryHealthy_():r===h9?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===g9&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const r=My("t",t),n=My("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:y9,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:m9,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:v9,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const r=My("t",t),n=My("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=My(EE,t);if(p9 in t){const n=t[p9];if(r===VAe){const o=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(o.h=this.repoInfo_.host),this.onHandshake_(o)}else if(r===v9){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(BAe))}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):fx(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(WAe))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:y9,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()&&(fh.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 FQ{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 zQ{constructor(t){this.allowedEvents_=t,this.listeners_={},$t(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 Tw extends zQ{static getInstance(){return new Tw}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!iQ()&&(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 $t(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 x9=32,b9=768;class qn{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 Yf(e){return e.pieces_.length-e.pieceNum_}function Qn(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 qn(r,0)}function Yr(e){return e.pieceNum_>=e.pieces_.length}function fs(e,t){const r=Vr(e),n=Vr(t);if(r===null)return t;if(r===n)return fs(Qn(e),Qn(t));throw new Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function O8(e,t){if(Yf(e)!==Yf(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 cc(e,t){let r=e.pieceNum_,n=t.pieceNum_;if(Yf(e)>Yf(t))return!1;for(;r0&&(e.byteLength_+=1),e.parts_.push(t),e.byteLength_+=ij(t),WQ(e)}function XAe(e){const t=e.parts_.pop();e.byteLength_-=ij(t),e.parts_.length>0&&(e.byteLength_-=1)}function WQ(e){if(e.byteLength_>b9)throw new Error(e.errorPrefix_+"has a key path longer than "+b9+" bytes ("+e.byteLength_+").");if(e.parts_.length>x9)throw new Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+x9+") or object contains a cycle "+eh(e))}function eh(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 N8 extends zQ{static getInstance(){return new N8}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 $t(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 Dy=1e3,ZAe=300*1e3,w9=30*1e3,JAe=1.3,e6e=3e4,t6e="server_kill",S9=3;class md extends FQ{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=md.nextPersistentConnectionId_++,this.log_=Kb("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_=Dy,this.maxReconnectDelay_=ZAe,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");N8.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")===-1&&Tw.getInstance().on("online",this.onOnline_,this)}sendRequest(t,r,n){const o=++this.requestNumber_,a={r:o,a:t,b:r};this.log_(zo(a)),$t(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 _8,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),$t(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),$t(!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;md.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"&&Rd(t,"w")){const n=fv(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||$Ee(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=w9)}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=qEe(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),$t(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: "+zo(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):_6("Unrecognized action received from server: "+zo(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){$t(!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_=Dy,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Dy,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_>e6e&&(this.reconnectDelay_=Dy),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_*JAe)}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+":"+md.nextConnectionId_++,a=this.lastSessionId;let s=!1,l=null;const c=function(){l?l.close():(s=!0,n())},u=function(f){$t(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?xa("getToken() completed but was canceled"):(xa("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=h&&h.token,l=new YAe(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,r,n,p=>{Xs(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(t6e)},a))}catch(f){this.log_("Failed to get token: "+f),s||(this.repoInfo_.nodeAdmin&&Xs(f),c())}}}interrupt(t){xa("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){xa("Resuming connection for reason: "+t),delete this.interruptReasons_[t],QB(this.interruptReasons_)&&(this.reconnectDelay_=Dy,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const r=t-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let t=0;tA8(a)).join("$"):n="default";const o=this.removeListen_(t,n);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(t,r){const n=new qn(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){xa("Auth token revoked: "+t+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(t==="invalid_token"||t==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=S9&&(this.reconnectDelay_=w9,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,r){xa("App check token revoked: "+t+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(t==="invalid_token"||t==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=S9&&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??ps.EMPTY_NODE,this.right=a??ps.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 ps.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 ps.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 r6e{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 ps{constructor(t,r=ps.EMPTY_NODE){this.comparator_=t,this.root_=r}insert(t,r){return new ps(this.comparator_,this.root_.insert(t,r,this.comparator_).copy(null,null,Ro.BLACK,null,null))}remove(t){return new ps(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 w1(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,r){return new w1(this.root_,t,this.comparator_,!1,r)}getReverseIteratorFrom(t,r){return new w1(this.root_,t,this.comparator_,!0,r)}getReverseIterator(t){return new w1(this.root_,null,this.comparator_,!0,t)}}ps.EMPTY_NODE=new r6e;/** - * @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 n6e(e,t){return zv(e.name,t.name)}function R8(e,t){return zv(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 E6;function i6e(e){E6=e}const $Q=function(e){return typeof e=="number"?"number:"+xQ(e):"string:"+e},UQ=function(e){if(e.isLeafNode()){const t=e.val();$t(typeof t=="string"||typeof t=="number"||typeof t=="object"&&Rd(t,".sv"),"Priority must be a string or number.")}else $t(e===E6||e.isEmpty(),"priority of unexpected type.");$t(e===E6||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 j9;class Io{static set __childrenNodeConstructor(t){j9=t}static get __childrenNodeConstructor(){return j9}constructor(t,r=Io.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=r,this.lazyHash_=null,$t(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),UQ(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Io(this.value_,t)}getImmediateChild(t){return t===".priority"?this.priorityNode_:Io.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return Yr(t)?this:Vr(t)===".priority"?this.priorityNode_:Io.__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:Io.__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:($t(n!==".priority"||Yf(t)===1,".priority must be the last token in a path"),this.updateImmediateChild(n,Io.__childrenNodeConstructor.EMPTY_NODE.updateChild(Qn(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:"+$Q(this.priorityNode_.val())+":");const r=typeof this.value_;t+=r+":",r==="number"?t+=xQ(this.value_):t+=this.value_,this.lazyHash_=mQ(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Io.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Io.__childrenNodeConstructor?-1:($t(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const r=typeof t.value_,n=typeof this.value_,o=Io.VALUE_TYPE_ORDER.indexOf(r),a=Io.VALUE_TYPE_ORDER.indexOf(n);return $t(o>=0,"Unknown leaf type: "+r),$t(a>=0,"Unknown leaf type: "+n),o===a?n==="object"?0:this.value_parseInt(Math.log(a)/l6e,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=fv(this.indexSet_,a);if($t(s,"Missing index implementation for "+a),o===Ug)if(s.isDefinedOn(t.node)){const l=[],c=r.getIterator($r.Wrap);let u=c.getNext();for(;u;)u.name!==t.name&&l.push(u),u=c.getNext();return l.push(t),Pw(l,s.getCompare())}else return Ug;else{const l=r.get(t.name);let c=o;return l&&(c=c.remove(new $r(t.name,l))),c.insert(t,t.node)}});return new ld(n,this.indexSet_)}removeFromIndexes(t,r){const n=_w(this.indexes_,o=>{if(o===Ug)return o;{const a=r.get(t.name);return a?o.remove(new $r(t.name,a)):o}});return new ld(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 By;class kr{static get EMPTY_NODE(){return By||(By=new kr(new ps(R8),null,ld.Default))}constructor(t,r,n){this.children_=t,this.priorityNode_=r,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&UQ(this.priorityNode_),this.children_.isEmpty()&&$t(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||By}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?By:r}}getChild(t){const r=Vr(t);return r===null?this:this.getImmediateChild(r).getChild(Qn(t))}hasChild(t){return this.children_.get(t)!==null}updateImmediateChild(t,r){if($t(r,"We should always be passing snapshot nodes"),t===".priority")return this.updatePriority(r);{const n=new $r(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()?By:this.priorityNode_;return new kr(o,s,a)}}updateChild(t,r){const n=Vr(t);if(n===null)return r;{$t(Vr(t)!==".priority"||Yf(t)===1,".priority must be the last token in a path");const o=this.getImmediateChild(n).updateChild(Qn(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(Ni,(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:"+$Q(this.getPriority().val())+":"),this.forEachChild(Ni,(r,n)=>{const o=n.hash();o!==""&&(t+=":"+r+":"+o)}),this.lazyHash_=t===""?"":mQ(t)}return this.lazyHash_}getPredecessorChildName(t,r,n){const o=this.resolveIndex_(n);if(o){const a=o.getPredecessorKey(new $r(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 $r(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 $r(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,$r.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,$r.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===Xb?-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(Ni),o=r.getIterator(Ni);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 u6e extends kr{constructor(){super(new ps(R8),kr.EMPTY_NODE,ld.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 Xb=new u6e;Object.defineProperties($r,{MIN:{value:new $r(pv,kr.EMPTY_NODE)},MAX:{value:new $r(Rh,Xb)}});qQ.__EMPTY_NODE=kr.EMPTY_NODE;Io.__childrenNodeConstructor=kr;i6e(Xb);a6e(Xb);/** - * @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 d6e=!0;function ba(e,t=null){if(e===null)return kr.EMPTY_NODE;if(typeof e=="object"&&".priority"in e&&(t=e[".priority"]),$t(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 Io(r,ba(t))}if(!(e instanceof Array)&&d6e){const r=[];let n=!1;if(ms(e,(s,l)=>{if(s.substring(0,1)!=="."){const c=ba(l);c.isEmpty()||(n=n||!c.getPriority().isEmpty(),r.push(new $r(s,c)))}}),r.length===0)return kr.EMPTY_NODE;const a=Pw(r,n6e,s=>s.name,R8);if(n){const s=Pw(r,Ni.getCompare());return new kr(a,ba(t),new ld({".priority":s},{".priority":Ni}))}else return new kr(a,ba(t),ld.Default)}else{let r=kr.EMPTY_NODE;return ms(e,(n,o)=>{if(Rd(e,n)&&n.substring(0,1)!=="."){const a=ba(o);(a.isLeafNode()||!a.isEmpty())&&(r=r.updateImmediateChild(n,a))}}),r.updatePriority(ba(t))}}o6e(ba);/** - * @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 f6e extends aj{constructor(t){super(),this.indexPath_=t,$t(!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?zv(t.name,r.name):a}makePost(t,r){const n=ba(t),o=kr.EMPTY_NODE.updateChild(this.indexPath_,n);return new $r(r,o)}maxPost(){const t=kr.EMPTY_NODE.updateChild(this.indexPath_,Xb);return new $r(Rh,t)}toString(){return DQ(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 p6e extends aj{compare(t,r){const n=t.node.compareTo(r.node);return n===0?zv(t.name,r.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,r){return!t.equals(r)}minPost(){return $r.MIN}maxPost(){return $r.MAX}makePost(t,r){const n=ba(t);return new $r(r,n)}toString(){return".value"}}const h6e=new p6e;/** - * @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 YQ(e){return{type:"value",snapshotNode:e}}function hv(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function vb(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function yb(e,t,r){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:r}}function g6e(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 L8{constructor(t){this.index_=t}updateChild(t,r,n,o,a,s){$t(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(vb(r,l)):$t(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):l.isEmpty()?s.trackChildChange(hv(r,n)):s.trackChildChange(yb(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(Ni,(o,a)=>{r.hasChild(o)||n.trackChildChange(vb(o,a))}),r.isLeafNode()||r.forEachChild(Ni,(o,a)=>{if(t.hasChild(o)){const s=t.getImmediateChild(o);s.equals(a)||n.trackChildChange(yb(o,a,s))}else n.trackChildChange(hv(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 xb{constructor(t){this.indexedFilter_=new L8(t.getIndex()),this.index_=t.getIndex(),this.startPost_=xb.getStartPost_(t),this.endPost_=xb.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 $r(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(Ni,(s,l)=>{a.matches(new $r(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 m6e{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 xb(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 $r(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;$t(l.numChildren()===this.limit_,"");const c=new $r(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(yb(r,n,f)),l.updateImmediateChild(r,n);{a!=null&&a.trackChildChange(vb(r,f));const m=l.updateImmediateChild(r,kr.EMPTY_NODE);return h!=null&&this.rangedFilter_.matches(h)?(a!=null&&a.trackChildChange(hv(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(vb(u.name,u.node)),a.trackChildChange(hv(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 F8{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_=Ni}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return $t(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return $t(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:pv}hasEnd(){return this.endSet_}getIndexEndValue(){return $t(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return $t(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Rh}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return $t(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_===Ni}copy(){const t=new F8;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 v6e(e){return e.loadsAllData()?new L8(e.getIndex()):e.hasLimit()?new m6e(e):new xb(e)}function k9(e){const t={};if(e.isDefault())return t;let r;if(e.index_===Ni?r="$priority":e.index_===h6e?r="$value":e.index_===Sm?r="$key":($t(e.index_ instanceof f6e,"Unrecognized index type!"),r=e.index_.toString()),t.orderBy=zo(r),e.startSet_){const n=e.startAfterSet_?"startAfter":"startAt";t[n]=zo(e.indexStartValue_),e.startNameSet_&&(t[n]+=","+zo(e.indexStartName_))}if(e.endSet_){const n=e.endBeforeSet_?"endBefore":"endAt";t[n]=zo(e.indexEndValue_),e.endNameSet_&&(t[n]+=","+zo(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?t.limitToFirst=e.limit_:t.limitToLast=e.limit_),t}function _9(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_!==Ni&&(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 FQ{reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,r){return r!==void 0?"tag$"+r:($t(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_=Kb("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=k9(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),fv(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=k9(t._queryParams),n=t._path.toString(),o=new _8;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+UEe(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=fb(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 y6e{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 GQ(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=Qn(t),GQ(o,t,r)}}function A6(e,t,r){e.value!==null?r(t,e.value):x6e(e,(n,o)=>{const a=new qn(t.toString()+"/"+n);A6(o,a,r)})}function x6e(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 b6e{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),r=Object.assign({},t);return this.last_&&ms(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 C9=10*1e3,w6e=30*1e3,S6e=300*1e3;class j6e{constructor(t,r){this.server_=r,this.statsToReport_={},this.statsListener_=new b6e(t);const n=C9+(w6e-C9)*Math.random();fx(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),r={};let n=!1;ms(t,(o,a)=>{a>0&&Rd(this.statsToReport_,o)&&(r[o]=a,n=!0)}),n&&this.server_.reportStats(r),fx(this.reportStats_.bind(this),Math.floor(Math.random()*2*S6e))}}/** - * @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 uc;(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"})(uc||(uc={}));function KQ(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function z8(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function M8(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 Nw{constructor(t,r,n){this.path=t,this.affectedTree=r,this.revert=n,this.type=uc.ACK_USER_WRITE,this.source=KQ()}operationForChild(t){if(Yr(this.path)){if(this.affectedTree.value!=null)return $t(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const r=this.affectedTree.subtree(new qn(t));return new Nw(gn(),r,this.revert)}}else return $t(Vr(this.path)===t,"operationForChild called for unrelated child."),new Nw(Qn(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 bb{constructor(t,r){this.source=t,this.path=r,this.type=uc.LISTEN_COMPLETE}operationForChild(t){return Yr(this.path)?new bb(this.source,gn()):new bb(this.source,Qn(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 Lh{constructor(t,r,n){this.source=t,this.path=r,this.snap=n,this.type=uc.OVERWRITE}operationForChild(t){return Yr(this.path)?new Lh(this.source,gn(),this.snap.getImmediateChild(t)):new Lh(this.source,Qn(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 wb{constructor(t,r,n){this.source=t,this.path=r,this.children=n,this.type=uc.MERGE}operationForChild(t){if(Yr(this.path)){const r=this.children.subtree(new qn(t));return r.isEmpty()?null:r.value?new Lh(this.source,gn(),r.value):new wb(this.source,gn(),r)}else return $t(Vr(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new wb(this.source,Qn(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 Fh{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 k6e{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function _6e(e,t,r,n){const o=[],a=[];return t.forEach(s=>{s.type==="child_changed"&&e.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&a.push(g6e(s.childName,s.snapshotNode))}),Wy(e,o,"child_removed",t,n,r),Wy(e,o,"child_added",t,n,r),Wy(e,o,"child_moved",a,n,r),Wy(e,o,"child_changed",t,n,r),Wy(e,o,"value",t,n,r),o}function Wy(e,t,r,n,o,a){const s=n.filter(l=>l.type===r);s.sort((l,c)=>E6e(e,l,c)),s.forEach(l=>{const c=C6e(e,l,a);o.forEach(u=>{u.respondsTo(l.type)&&t.push(u.createEvent(c,e.query_))})})}function C6e(e,t,r){return t.type==="value"||t.type==="child_removed"||(t.prevName=r.getPredecessorChildName(t.childName,t.snapshotNode,e.index_)),t}function E6e(e,t,r){if(t.childName==null||r.childName==null)throw Fv("Should only compare child_ events.");const n=new $r(t.childName,t.snapshotNode),o=new $r(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 sj(e,t){return{eventCache:e,serverCache:t}}function px(e,t,r,n){return sj(new Fh(t,r,n),e.serverCache)}function QQ(e,t,r,n){return sj(e.eventCache,new Fh(t,r,n))}function T6(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function zh(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 TE;const A6e=()=>(TE||(TE=new ps(pAe)),TE);class ii{static fromObject(t){let r=new ii(null);return ms(t,(n,o)=>{r=r.set(new qn(n),o)}),r}constructor(t,r=A6e()){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:gn(),value:this.value};if(Yr(t))return null;{const n=Vr(t),o=this.children.get(n);if(o!==null){const a=o.findRootMostMatchingPathAndValue(Qn(t),r);return a!=null?{path:ho(new qn(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(Qn(t)):new ii(null)}}set(t,r){if(Yr(t))return new ii(r,this.children);{const n=Vr(t),a=(this.children.get(n)||new ii(null)).set(Qn(t),r),s=this.children.insert(n,a);return new ii(this.value,s)}}remove(t){if(Yr(t))return this.children.isEmpty()?new ii(null):new ii(null,this.children);{const r=Vr(t),n=this.children.get(r);if(n){const o=n.remove(Qn(t));let a;return o.isEmpty()?a=this.children.remove(r):a=this.children.insert(r,o),this.value===null&&a.isEmpty()?new ii(null):new ii(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(Qn(t)):null}}setTree(t,r){if(Yr(t))return r;{const n=Vr(t),a=(this.children.get(n)||new ii(null)).setTree(Qn(t),r);let s;return a.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,a),new ii(this.value,s)}}fold(t){return this.fold_(gn(),t)}fold_(t,r){const n={};return this.children.inorderTraversal((o,a)=>{n[o]=a.fold_(ho(t,o),r)}),r(t,this.value,n)}findOnPath(t,r){return this.findOnPath_(t,gn(),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_(Qn(t),ho(r,a),n):null}}foreachOnPath(t,r){return this.foreachOnPath_(t,gn(),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_(Qn(t),ho(r,o),n):new ii(null)}}foreach(t){this.foreach_(gn(),t)}foreach_(t,r){this.children.inorderTraversal((n,o)=>{o.foreach_(ho(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 fc{constructor(t){this.writeTree_=t}static empty(){return new fc(new ii(null))}}function hx(e,t,r){if(Yr(t))return new fc(new ii(r));{const n=e.writeTree_.findRootMostValueAndPath(t);if(n!=null){const o=n.path;let a=n.value;const s=fs(o,t);return a=a.updateChild(s,r),new fc(e.writeTree_.set(o,a))}else{const o=new ii(r),a=e.writeTree_.setTree(t,o);return new fc(a)}}}function E9(e,t,r){let n=e;return ms(r,(o,a)=>{n=hx(n,ho(t,o),a)}),n}function A9(e,t){if(Yr(t))return fc.empty();{const r=e.writeTree_.setTree(t,new ii(null));return new fc(r)}}function P6(e,t){return Zh(e,t)!=null}function Zh(e,t){const r=e.writeTree_.findRootMostValueAndPath(t);return r!=null?e.writeTree_.get(r.path).getChild(fs(r.path,t)):null}function T9(e){const t=[],r=e.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(Ni,(n,o)=>{t.push(new $r(n,o))}):e.writeTree_.children.inorderTraversal((n,o)=>{o.value!=null&&t.push(new $r(n,o.value))}),t}function Bf(e,t){if(Yr(t))return e;{const r=Zh(e,t);return r!=null?new fc(new ii(r)):new fc(e.writeTree_.subtree(t))}}function I6(e){return e.writeTree_.isEmpty()}function gv(e,t){return XQ(gn(),e.writeTree_,t)}function XQ(e,t,r){if(t.value!=null)return r.updateChild(e,t.value);{let n=null;return t.children.inorderTraversal((o,a)=>{o===".priority"?($t(a.value!==null,"Priority writes must always be leaf nodes"),n=a.value):r=XQ(ho(e,o),a,r)}),!r.getChild(e).isEmpty()&&n!==null&&(r=r.updateChild(ho(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 D8(e,t){return tX(t,e)}function T6e(e,t,r,n,o){$t(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=hx(e.visibleWrites,t,r)),e.lastWriteId=n}function P6e(e,t){for(let r=0;rl.writeId===t);$t(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&&O6e(l,n.path)?o=!1:cc(n.path,l.path)&&(a=!0)),s--}if(o){if(a)return N6e(e),!0;if(n.snap)e.visibleWrites=A9(e.visibleWrites,n.path);else{const l=n.children;ms(l,c=>{e.visibleWrites=A9(e.visibleWrites,ho(n.path,c))})}return!0}else return!1}function O6e(e,t){if(e.snap)return cc(e.path,t);for(const r in e.children)if(e.children.hasOwnProperty(r)&&cc(ho(e.path,r),t))return!0;return!1}function N6e(e){e.visibleWrites=ZQ(e.allWrites,R6e,gn()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1}function R6e(e){return e.visible}function ZQ(e,t,r){let n=fc.empty();for(let o=0;o{n=n.updateImmediateChild(a,s)}),n;if(r){const a=Bf(e.visibleWrites,t);return r.forEachChild(Ni,(s,l)=>{const c=gv(Bf(a,new qn(s)),l);n=n.updateImmediateChild(s,c)}),T9(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}else{const a=Bf(e.visibleWrites,t);return T9(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}}function F6e(e,t,r,n,o){$t(n||o,"Either existingEventSnap or existingServerSnap must exist");const a=ho(t,r);if(P6(e.visibleWrites,a))return null;{const s=Bf(e.visibleWrites,a);return I6(s)?o.getChild(r):gv(s,o.getChild(r))}}function z6e(e,t,r,n){const o=ho(t,r),a=Zh(e.visibleWrites,o);if(a!=null)return a;if(n.isCompleteForChild(r)){const s=Bf(e.visibleWrites,o);return gv(s,n.getNode().getImmediateChild(r))}else return null}function M6e(e,t){return Zh(e.visibleWrites,t)}function D6e(e,t,r,n,o,a,s){let l;const c=Bf(e.visibleWrites,t),u=Zh(c,gn());if(u!=null)l=u;else if(r!=null)l=gv(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(YQ(T6(t)))}}function nX(e,t,r,n,o,a){const s=t.eventCache;if(Lw(n,r)!=null)return t;{let l,c;if(Yr(r))if($t(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){const u=zh(t),d=u instanceof kr?u:kr.EMPTY_NODE,f=B8(n,d);l=e.filter.updateFullNode(t.eventCache.getNode(),f,a)}else{const u=Rw(n,zh(t));l=e.filter.updateFullNode(t.eventCache.getNode(),u,a)}else{const u=Vr(r);if(u===".priority"){$t(Yf(r)===1,"Can't have a priority with additional path components");const d=s.getNode();c=t.serverCache.getNode();const f=P9(n,r,d,c);f!=null?l=e.filter.updatePriority(d,f):l=s.getNode()}else{const d=Qn(r);let f;if(s.isCompleteForChild(u)){c=t.serverCache.getNode();const h=P9(n,r,s.getNode(),c);h!=null?f=s.getNode().getImmediateChild(u).updateChild(d,h):f=s.getNode().getImmediateChild(u)}else f=W8(n,u,t.serverCache);f!=null?l=e.filter.updateChild(s.getNode(),u,f,d,o,a):l=s.getNode()}}return px(t,l,s.isFullyInitialized()||Yr(r),e.filter.filtersNodes())}}function Fw(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)&&Yf(r)>1)return t;const v=Qn(r),b=c.getNode().getImmediateChild(p).updateChild(v,n);p===".priority"?u=d.updatePriority(c.getNode(),b):u=d.updateChild(c.getNode(),p,b,v,rX,null)}const f=QQ(t,u,c.isFullyInitialized()||Yr(r),d.filtersNodes()),h=new q8(o,f,a);return nX(e,f,r,o,h,l)}function O6(e,t,r,n,o,a,s){const l=t.eventCache;let c,u;const d=new q8(o,t,a);if(Yr(r))u=e.filter.updateFullNode(t.eventCache.getNode(),n,s),c=px(t,u,!0,e.filter.filtersNodes());else{const f=Vr(r);if(f===".priority")u=e.filter.updatePriority(t.eventCache.getNode(),n),c=px(t,u,l.isFullyInitialized(),l.isFiltered());else{const h=Qn(r),p=l.getNode().getImmediateChild(f);let v;if(Yr(h))v=n;else{const m=d.getCompleteChild(f);m!=null?MQ(h)===".priority"&&m.getChild(BQ(h)).isEmpty()?v=m:v=m.updateChild(h,n):v=kr.EMPTY_NODE}if(p.equals(v))c=t;else{const m=e.filter.updateChild(l.getNode(),f,v,h,d,s);c=px(t,m,l.isFullyInitialized(),e.filter.filtersNodes())}}}return c}function I9(e,t){return e.eventCache.isCompleteForChild(t)}function G6e(e,t,r,n,o,a,s){let l=t;return n.foreach((c,u)=>{const d=ho(r,c);I9(t,Vr(d))&&(l=O6(e,l,d,u,o,a,s))}),n.foreach((c,u)=>{const d=ho(r,c);I9(t,Vr(d))||(l=O6(e,l,d,u,o,a,s))}),l}function O9(e,t,r){return r.foreach((n,o)=>{t=t.updateChild(n,o)}),t}function N6(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 ii(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),v=O9(e,p,h);c=Fw(e,c,new qn(f),v,o,a,s,l)}}),u.children.inorderTraversal((f,h)=>{const p=!t.serverCache.isCompleteForChild(f)&&h.value===null;if(!d.hasChild(f)&&!p){const v=t.serverCache.getNode().getImmediateChild(f),m=O9(e,v,h);c=Fw(e,c,new qn(f),m,o,a,s,l)}}),c}function K6e(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 Fw(e,t,r,c.getNode().getChild(r),o,a,l,s);if(Yr(r)){let u=new ii(null);return c.getNode().forEachChild(Sm,(d,f)=>{u=u.set(new qn(d),f)}),N6(e,t,r,u,o,a,l,s)}else return t}else{let u=new ii(null);return n.foreach((d,f)=>{const h=ho(r,d);c.isCompleteForPath(h)&&(u=u.set(d,c.getNode().getChild(h)))}),N6(e,t,r,u,o,a,l,s)}}function Q6e(e,t,r,n,o){const a=t.serverCache,s=QQ(t,a.getNode(),a.isFullyInitialized()||Yr(r),a.isFiltered());return nX(e,s,r,n,rX,o)}function X6e(e,t,r,n,o,a){let s;if(Lw(n,r)!=null)return t;{const l=new q8(n,t,o),c=t.eventCache.getNode();let u;if(Yr(r)||Vr(r)===".priority"){let d;if(t.serverCache.isFullyInitialized())d=Rw(n,zh(t));else{const f=t.serverCache.getNode();$t(f instanceof kr,"serverChildren would be complete if leaf node"),d=B8(n,f)}d=d,u=e.filter.updateFullNode(c,d,a)}else{const d=Vr(r);let f=W8(n,d,t.serverCache);f==null&&t.serverCache.isCompleteForChild(d)&&(f=c.getImmediateChild(d)),f!=null?u=e.filter.updateChild(c,d,f,Qn(r),l,a):t.eventCache.getNode().hasChild(d)?u=e.filter.updateChild(c,d,kr.EMPTY_NODE,Qn(r),l,a):u=c,u.isEmpty()&&t.serverCache.isFullyInitialized()&&(s=Rw(n,zh(t)),s.isLeafNode()&&(u=e.filter.updateFullNode(u,s,a)))}return s=t.serverCache.isFullyInitialized()||Lw(n,gn())!=null,px(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 Z6e{constructor(t,r){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,o=new L8(n.getIndex()),a=v6e(n);this.processor_=U6e(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 Fh(c,s.isFullyInitialized(),o.filtersNodes()),f=new Fh(u,l.isFullyInitialized(),a.filtersNodes());this.viewCache_=sj(f,d),this.eventGenerator_=new k6e(this.query_)}get query(){return this.query_}}function J6e(e){return e.viewCache_.serverCache.getNode()}function eTe(e,t){const r=zh(e.viewCache_);return r&&(e.query._queryParams.loadsAllData()||!Yr(t)&&!r.getImmediateChild(Vr(t)).isEmpty())?r.getChild(t):null}function N9(e){return e.eventRegistrations_.length===0}function tTe(e,t){e.eventRegistrations_.push(t)}function R9(e,t,r){const n=[];if(r){$t(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(hv(a,s))}),r.isFullyInitialized()&&n.push(YQ(r.getNode())),iX(e,n,r.getNode(),t)}function iX(e,t,r,n){const o=n?[n]:e.eventRegistrations_;return _6e(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 zw;class nTe{constructor(){this.views=new Map}}function iTe(e){$t(!zw,"__referenceConstructor has already been defined"),zw=e}function oTe(){return $t(zw,"Reference.ts has not been loaded"),zw}function aTe(e){return e.views.size===0}function $8(e,t,r,n){const o=t.source.queryId;if(o!==null){const a=e.views.get(o);return $t(a!=null,"SyncTree gave us an op for an invalid query."),L9(a,t,r,n)}else{let a=[];for(const s of e.views.values())a=a.concat(L9(s,t,r,n));return a}}function sTe(e,t,r,n,o){const a=t._queryIdentifier,s=e.views.get(a);if(!s){let l=Rw(r,o?n:null),c=!1;l?c=!0:n instanceof kr?(l=B8(r,n),c=!1):(l=kr.EMPTY_NODE,c=!1);const u=sj(new Fh(l,c,!1),new Fh(n,o,!1));return new Z6e(t,u)}return s}function lTe(e,t,r,n,o,a){const s=sTe(e,t,n,o,a);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,s),tTe(s,r),rTe(s,r)}function cTe(e,t,r,n){const o=t._queryIdentifier,a=[];let s=[];const l=Gf(e);if(o==="default")for(const[c,u]of e.views.entries())s=s.concat(R9(u,r,n)),N9(u)&&(e.views.delete(c),u.query._queryParams.loadsAllData()||a.push(u.query));else{const c=e.views.get(o);c&&(s=s.concat(R9(c,r,n)),N9(c)&&(e.views.delete(o),c.query._queryParams.loadsAllData()||a.push(c.query)))}return l&&!Gf(e)&&a.push(new(oTe())(t._repo,t._path)),{removed:a,events:s}}function oX(e){const t=[];for(const r of e.views.values())r.query._queryParams.loadsAllData()||t.push(r);return t}function jm(e,t){let r=null;for(const n of e.views.values())r=r||eTe(n,t);return r}function aX(e,t){if(t._queryParams.loadsAllData())return lj(e);{const n=t._queryIdentifier;return e.views.get(n)}}function sX(e,t){return aX(e,t)!=null}function Gf(e){return lj(e)!=null}function lj(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 Mw;function uTe(e){$t(!Mw,"__referenceConstructor has already been defined"),Mw=e}function dTe(){return $t(Mw,"Reference.ts has not been loaded"),Mw}let fTe=1;class F9{constructor(t){this.listenProvider_=t,this.syncPointTree_=new ii(null),this.pendingWriteTree_=B6e(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function pTe(e,t,r,n,o){return T6e(e.pendingWriteTree_,t,r,n,o),o?Zb(e,new Lh(KQ(),t,r)):[]}function cm(e,t,r=!1){const n=P6e(e.pendingWriteTree_,t);if(I6e(e.pendingWriteTree_,t)){let a=new ii(null);return n.snap!=null?a=a.set(gn(),!0):ms(n.children,s=>{a=a.set(new qn(s),!0)}),Zb(e,new Nw(n.path,a,r))}else return[]}function cj(e,t,r){return Zb(e,new Lh(z8(),t,r))}function hTe(e,t,r){const n=ii.fromObject(r);return Zb(e,new wb(z8(),t,n))}function gTe(e,t){return Zb(e,new bb(z8(),t))}function mTe(e,t,r){const n=U8(e,r);if(n){const o=H8(n),a=o.path,s=o.queryId,l=fs(a,t),c=new bb(M8(s),l);return V8(e,a,c)}else return[]}function R6(e,t,r,n,o=!1){const a=t._path,s=e.syncPointTree_.get(a);let l=[];if(s&&(t._queryIdentifier==="default"||sX(s,t))){const c=cTe(s,t,r,n);aTe(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)=>Gf(p));if(d&&!f){const h=e.syncPointTree_.subtree(a);if(!h.isEmpty()){const p=xTe(h);for(let v=0;v0&&!n&&(d?e.listenProvider_.stopListening(gx(t),null):u.forEach(h=>{const p=e.queryToTagMap.get(uj(h));e.listenProvider_.stopListening(gx(h),p)}))}bTe(e,u)}return l}function vTe(e,t,r,n){const o=U8(e,n);if(o!=null){const a=H8(o),s=a.path,l=a.queryId,c=fs(s,t),u=new Lh(M8(l),c,r);return V8(e,s,u)}else return[]}function yTe(e,t,r,n){const o=U8(e,n);if(o){const a=H8(o),s=a.path,l=a.queryId,c=fs(s,t),u=ii.fromObject(r),d=new wb(M8(l),c,u);return V8(e,s,d)}else return[]}function z9(e,t,r,n=!1){const o=t._path;let a=null,s=!1;e.syncPointTree_.foreachOnPath(o,(h,p)=>{const v=fs(h,o);a=a||jm(p,v),s=s||Gf(p)});let l=e.syncPointTree_.get(o);l?(s=s||Gf(l),a=a||jm(l,gn())):(l=new nTe,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,v)=>{const m=jm(v,gn());m&&(a=a.updateImmediateChild(p,m))}));const u=sX(l,t);if(!u&&!t._queryParams.loadsAllData()){const h=uj(t);$t(!e.queryToTagMap.has(h),"View does not exist, but we have a tag");const p=wTe();e.queryToTagMap.set(h,p),e.tagToQueryMap.set(p,h)}const d=D8(e.pendingWriteTree_,o);let f=lTe(l,t,r,d,a,c);if(!u&&!s&&!n){const h=aX(l,t);f=f.concat(STe(e,t,h))}return f}function lX(e,t,r){const o=e.pendingWriteTree_,a=e.syncPointTree_.findOnPath(t,(s,l)=>{const c=fs(s,t),u=jm(l,c);if(u)return u});return JQ(o,t,a,r,!0)}function Zb(e,t){return cX(t,e.syncPointTree_,null,D8(e.pendingWriteTree_,gn()))}function cX(e,t,r,n){if(Yr(e.path))return uX(e,t,r,n);{const o=t.get(gn());r==null&&o!=null&&(r=jm(o,gn()));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=eX(n,s);a=a.concat(cX(l,c,u,d))}return o&&(a=a.concat($8(o,e,n,r))),a}}function uX(e,t,r,n){const o=t.get(gn());r==null&&o!=null&&(r=jm(o,gn()));let a=[];return t.children.inorderTraversal((s,l)=>{const c=r?r.getImmediateChild(s):null,u=eX(n,s),d=e.operationForChild(s);d&&(a=a.concat(uX(d,l,c,u)))}),o&&(a=a.concat($8(o,e,n,r))),a}function dX(e,t){const r=t.query,n=Dw(e,r);return{hashFn:()=>(J6e(t)||kr.EMPTY_NODE).hash(),onComplete:o=>{if(o==="ok")return n?mTe(e,r._path,n):gTe(e,r._path);{const a=mAe(o,r);return R6(e,r,null,a)}}}}function Dw(e,t){const r=uj(t);return e.queryToTagMap.get(r)}function uj(e){return e._path.toString()+"$"+e._queryIdentifier}function U8(e,t){return e.tagToQueryMap.get(t)}function H8(e){const t=e.indexOf("$");return $t(t!==-1&&t{if(r&&Gf(r))return[lj(r)];{let o=[];return r&&(o=oX(r)),ms(n,(a,s)=>{o=o.concat(s)}),o}})}function gx(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(dTe())(e._repo,e._path):e}function bTe(e,t){for(let r=0;r{if(!Yr(u)&&d&&Gf(d))return[lj(d).query];{let h=[];return d&&(h=h.concat(oX(d).map(p=>p.query))),ms(f,(p,v)=>{h=h.concat(v)}),h}});for(let u=0;u{const u=K8(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 Q8{constructor(t="",r=null,n={children:{},childCount:0}){this.name=t,this.parent=r,this.node=n}}function X8(e,t){let r=t instanceof qn?t:new qn(t),n=e,o=Vr(r);for(;o!==null;){const a=fv(n.node.children,o)||{children:{},childCount:0};n=new Q8(o,n,a),r=Qn(r),o=Vr(r)}return n}function Mv(e){return e.node.value}function fX(e,t){e.node.value=t,L6(e)}function pX(e){return e.node.childCount>0}function ATe(e){return Mv(e)===void 0&&!pX(e)}function dj(e,t){ms(e.node.children,(r,n)=>{t(new Q8(r,e,n))})}function hX(e,t,r,n){r&&t(e),dj(e,o=>{hX(o,t,!0)})}function TTe(e,t,r){let n=e.parent;for(;n!==null;){if(t(n))return!0;n=n.parent}return!1}function Jb(e){return new qn(e.parent===null?e.name:Jb(e.parent)+"/"+e.name)}function L6(e){e.parent!==null&&PTe(e.parent,e.name,e)}function PTe(e,t,r){const n=ATe(r),o=Rd(e.node.children,t);n&&o?(delete e.node.children[t],e.node.childCount--,L6(e)):!n&&!o&&(e.node.children[t]=r.node,e.node.childCount++,L6(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 ITe=/[\[\].#$\/\u0000-\u001F\u007F]/,OTe=/[\[\].#$\u0000-\u001F\u007F]/,PE=10*1024*1024,gX=function(e){return typeof e=="string"&&e.length!==0&&!ITe.test(e)},mX=function(e){return typeof e=="string"&&e.length!==0&&!OTe.test(e)},NTe=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),mX(e)},vX=function(e,t,r){const n=r instanceof qn?new KAe(r,e):r;if(t===void 0)throw new Error(e+"contains undefined "+eh(n));if(typeof t=="function")throw new Error(e+"contains a function "+eh(n)+" with contents = "+t.toString());if(vQ(t))throw new Error(e+"contains "+t.toString()+" "+eh(n));if(typeof t=="string"&&t.length>PE/3&&ij(t)>PE)throw new Error(e+"contains a string greater than "+PE+" utf8 bytes "+eh(n)+" ('"+t.substring(0,50)+"...')");if(t&&typeof t=="object"){let o=!1,a=!1;if(ms(t,(s,l)=>{if(s===".value")o=!0;else if(s!==".priority"&&s!==".sv"&&(a=!0,!gX(s)))throw new Error(e+" contains an invalid key ("+s+") "+eh(n)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);QAe(n,s),vX(e,l,n),XAe(n)}),o&&a)throw new Error(e+' contains ".value" child '+eh(n)+" in addition to actual children.")}},yX=function(e,t,r,n){if(!mX(r))throw new Error(sQ(e,t)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},RTe=function(e,t,r,n){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),yX(e,t,r)},LTe=function(e,t){const r=t.path.toString();if(typeof t.repoInfo.host!="string"||t.repoInfo.host.length===0||!gX(t.repoInfo.namespace)&&t.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!NTe(r))throw new Error(sQ(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 FTe{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function xX(e,t){let r=null;for(let n=0;nO8(n,t))}function Jh(e,t,r){xX(e,r),wX(e,n=>cc(n,t)||cc(t,n))}function wX(e,t){e.recursionDepth_++;let r=!0;for(let n=0;n{D9(e,n,o,a,s)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>B9(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{zo(r)}catch(n){throw new Error("Invalid authOverride provided: "+n)}}e.persistentConnection_=new md(e.repoInfo_,t,(n,o,a,s)=>{D9(e,n,o,a,s)},n=>{B9(e,n)},n=>{$Te(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_=_Ae(e.repoInfo_,()=>new j6e(e.stats_,e.server_)),e.infoData_=new y6e,e.infoSyncTree_=new F9({startListening:(n,o,a,s)=>{let l=[];const c=e.infoData_.getNode(n._path);return c.isEmpty()||(l=cj(e.infoSyncTree_,n._path,c),setTimeout(()=>{s("ok")},0)),l},stopListening:()=>{}}),Z8(e,"connected",!1),e.serverSyncTree_=new F9({startListening:(n,o,a,s)=>(e.server_.listen(n,a,o,(l,c)=>{const u=s(l,c);Jh(e.eventQueue_,n._path,u)}),[]),stopListening:(n,o)=>{e.server_.unlisten(n,o)}})}function qTe(e){const r=e.infoData_.getNode(new qn(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function SX(e){return jTe({timestamp:qTe(e)})}function D9(e,t,r,n,o){e.dataUpdateCount++;const a=new qn(t);r=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,r):r;let s=[];if(o)if(n){const c=_w(r,u=>ba(u));s=yTe(e.serverSyncTree_,a,c,o)}else{const c=ba(r);s=vTe(e.serverSyncTree_,a,c,o)}else if(n){const c=_w(r,u=>ba(u));s=hTe(e.serverSyncTree_,a,c)}else{const c=ba(r);s=cj(e.serverSyncTree_,a,c)}let l=a;s.length>0&&(l=eI(e,a)),Jh(e.eventQueue_,l,s)}function B9(e,t){Z8(e,"connected",t),t===!1&&HTe(e)}function $Te(e,t){ms(t,(r,n)=>{Z8(e,r,n)})}function Z8(e,t,r){const n=new qn("/.info/"+t),o=ba(r);e.infoData_.updateSnapshot(n,o);const a=cj(e.infoSyncTree_,n,o);Jh(e.eventQueue_,n,a)}function UTe(e){return e.nextWriteId_++}function HTe(e){jX(e,"onDisconnectEvents");const t=SX(e),r=Ow();A6(e.onDisconnect_,gn(),(o,a)=>{const s=CTe(o,a,e.serverSyncTree_,t);GQ(r,o,s)});let n=[];A6(r,gn(),(o,a)=>{n=n.concat(cj(e.serverSyncTree_,o,a));const s=QTe(e,o);eI(e,s)}),e.onDisconnect_=Ow(),Jh(e.eventQueue_,gn(),n)}function VTe(e,t,r){let n;Vr(t._path)===".info"?n=z9(e.infoSyncTree_,t,r):n=z9(e.serverSyncTree_,t,r),bX(e.eventQueue_,t._path,n)}function W9(e,t,r){let n;Vr(t._path)===".info"?n=R6(e.infoSyncTree_,t,r):n=R6(e.serverSyncTree_,t,r),bX(e.eventQueue_,t._path,n)}function YTe(e){e.persistentConnection_&&e.persistentConnection_.interrupt(MTe)}function jX(e,...t){let r="";e.persistentConnection_&&(r=e.persistentConnection_.id+":"),xa(r,...t)}function kX(e,t,r){return lX(e.serverSyncTree_,t,r)||kr.EMPTY_NODE}function J8(e,t=e.transactionQueueTree_){if(t||fj(e,t),Mv(t)){const r=CX(e,t);$t(r.length>0,"Sending zero length transaction queue"),r.every(o=>o.status===0)&>e(e,Jb(t),r)}else pX(t)&&dj(t,r=>{J8(e,r)})}function GTe(e,t,r){const n=r.map(u=>u.currentWriteId),o=kX(e,t,n);let a=o;const s=o.hash();for(let u=0;u{jX(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();fj(e,X8(e.transactionQueueTree_,t)),J8(e,e.transactionQueueTree_),Jh(e.eventQueue_,t,d);for(let h=0;hl.status===0).map(l=>l.currentWriteId);for(let l=0;l=DTe)d=!0,f="maxretry",o=o.concat(cm(e.serverSyncTree_,c.currentWriteId,!0));else{const h=kX(e,c.path,s);c.currentInputSnapshot=h;const p=t[l].update(h.val());if(p!==void 0){vX("transaction failed: Data returned ",p,c.path);let v=ba(p);typeof p=="object"&&p!=null&&Rd(p,".priority")||(v=v.updatePriority(h.getPriority()));const b=c.currentWriteId,x=SX(e),w=ETe(v,h,x);c.currentOutputSnapshotRaw=v,c.currentOutputSnapshotResolved=w,c.currentWriteId=UTe(e),s.splice(s.indexOf(b),1),o=o.concat(pTe(e.serverSyncTree_,c.path,w,c.currentWriteId,c.applyLocally)),o=o.concat(cm(e.serverSyncTree_,b,!0))}else d=!0,f="nodata",o=o.concat(cm(e.serverSyncTree_,c.currentWriteId,!0))}Jh(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))))}fj(e,e.transactionQueueTree_);for(let l=0;ln.order-o.order),r}function EX(e,t,r){const n=Mv(t);if(n)for(let o=0;o{EX(e,o,r)})}function fj(e,t){const r=Mv(t);if(r){let n=0;for(let o=0;o0?r:void 0)}dj(t,n=>{fj(e,n)})}function QTe(e,t){const r=Jb(_X(e,t)),n=X8(e.transactionQueueTree_,t);return TTe(n,o=>{IE(e,o)}),IE(e,n),hX(n,o=>{IE(e,o)}),r}function IE(e,t){const r=Mv(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 ZTe(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 q9=function(e,t){const r=JTe(e),n=r.namespace;r.domain==="firebase.com"&&kd(r.host+" is no longer supported. Please use .firebaseio.com instead"),(!n||n==="undefined")&&r.domain!=="localhost"&&kd("Cannot parse Firebase url. Please use https://.firebaseio.com"),r.secure||dAe();const o=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new TQ(r.host,r.secure,n,o,t,"",n!==r.subdomain),path:new qn(r.pathString)}},JTe=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 v=t.indexOf(".");n=t.substring(0,v).toLowerCase(),r=t.substring(v+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 ePe{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+":"+zo(this.snapshot.exportVal())}}class tPe{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 rPe{constructor(t,r){this.snapshotCallback=t,this.cancelCallback=r}onValue(t,r){this.snapshotCallback.call(null,t,r)}onCancel(t){return $t(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 tI{constructor(t,r,n,o){this._repo=t,this._path=r,this._queryParams=n,this._orderByCalled=o}get key(){return Yr(this._path)?null:MQ(this._path)}get ref(){return new ip(this._repo,this._path)}get _queryIdentifier(){const t=_9(this._queryParams),r=A8(t);return r==="{}"?"default":r}get _queryObject(){return _9(this._queryParams)}isEqual(t){if(t=oj(t),!(t instanceof tI))return!1;const r=this._repo===t._repo,n=O8(this._path,t._path),o=this._queryIdentifier===t._queryIdentifier;return r&&n&&o}toJSON(){return this.toString()}toString(){return this._repo.toString()+GAe(this._path)}}class ip extends tI{constructor(t,r){super(t,r,new F8,!1)}get parent(){const t=BQ(this._path);return t===null?null:new ip(this._repo,t)}get root(){let t=this;for(;t.parent!==null;)t=t.parent;return t}}class Bw{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 qn(t),n=F6(this.ref,t);return new Bw(this._node.getChild(r),n,Ni)}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 Bw(o,F6(this.ref,n),Ni)))}hasChild(t){const r=new qn(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 nPe(e,t){return e=oj(e),e._checkNotDeleted("ref"),t!==void 0?F6(e._root,t):e._root}function F6(e,t){return e=oj(e),Vr(e._path)===null?RTe("child","path",t):yX("child","path",t),new ip(e._repo,ho(e._path,t))}class rI{constructor(t){this.callbackContext=t}respondsTo(t){return t==="value"}createEvent(t,r){const n=r._queryParams.getIndex();return new ePe("value",this,new Bw(t.snapshotNode,new ip(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 tPe(this,t,r):null}matches(t){return t instanceof rI?!t.callbackContext||!this.callbackContext?!0:t.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}function iPe(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)=>{W9(e._repo,e,l),c(d,f)};u.userCallback=r.userCallback,u.context=r.context,r=u}const s=new rPe(r,a||void 0),l=new rI(s);return VTe(e._repo,e,l),()=>W9(e._repo,e,l)}function oPe(e,t,r,n){return iPe(e,"value",t,r,n)}iTe(ip);uTe(ip);/** - * @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 aPe="FIREBASE_DATABASE_EMULATOR_HOST",z6={};let sPe=!1;function lPe(e,t,r,n){const o=t.lastIndexOf(":"),a=t.substring(0,o),s=C8(a);e.repoInfo_=new TQ(t,s,e.repoInfo_.namespace,e.repoInfo_.webSocketOnly,e.repoInfo_.nodeAdmin,e.repoInfo_.persistenceKey,e.repoInfo_.includeNamespaceInQueryParams,!0,r),n&&(e.authTokenProvider_=n)}function cPe(e,t,r,n,o){let a=n||e.options.databaseURL;a===void 0&&(e.options.projectId||kd("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),xa("Using default host for project ",e.options.projectId),a=`${e.options.projectId}-default-rtdb.firebaseio.com`);let s=q9(a,o),l=s.repoInfo,c;typeof process<"u"&&s9&&(c=s9[aPe]),c?(a=`http://${c}?ns=${l.namespace}`,s=q9(a,o),l=s.repoInfo):s.repoInfo.secure;const u=new SAe(e.name,e.options,t);LTe("Invalid Firebase Database URL",s),Yr(s.path)||kd("Database URL must point to the root of a Firebase Database (not including a child path).");const d=dPe(l,e,u,new wAe(e,r));return new fPe(d,e)}function uPe(e,t){const r=z6[t];(!r||r[e.key]!==e)&&kd(`Database ${t}(${e.repoInfo_}) has already been deleted.`),YTe(e),delete r[e.key]}function dPe(e,t,r,n){let o=z6[t.name];o||(o={},z6[t.name]=o);let a=o[e.toURLString()];return a&&kd("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),a=new BTe(e,sPe,r,n),o[e.toURLString()]=a,a}class fPe{constructor(t,r){this._repoInternal=t,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(WTe(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ip(this._repo,gn())),this._rootInternal}_delete(){return this._rootInternal!==null&&(uPe(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){this._rootInternal===null&&kd("Cannot call "+t+" on a deleted database.")}}function pPe(e=G3e(),t){const r=$3e(e,"database").getImmediate({identifier:t});if(!r._instanceStarted){const n=AEe("database");n&&hPe(r,...n)}return r}function hPe(e,t,r,n={}){e=oj(e),e._checkNotDeleted("useEmulator");const o=`${t}:${r}`,a=e._repoInternal;if(e._instanceStarted){if(o===e._repoInternal.repoInfo_.host&&Cw(n,a.repoInfo_.emulatorOptions))return;kd("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(a.repoInfo_.nodeAdmin)n.mockUserToken&&kd('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 $1($1.OWNER);else if(n.mockUserToken){const l=typeof n.mockUserToken=="string"?n.mockUserToken:PEe(n.mockUserToken,e.app.options.projectId);s=new $1(l)}C8(t)&&(TEe(t),NEe("Database",!0)),lPe(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 gPe(e){oAe(Y3e),Ew(new pb("database",(t,{instanceIdentifier:r})=>{const n=t.getProvider("app").getImmediate(),o=t.getProvider("auth-internal"),a=t.getProvider("app-check-internal");return cPe(n,o,a,r)},"PUBLIC").setMultipleInstances(!0)),bm(l9,c9,e),bm(l9,c9,"esm2017")}md.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)};md.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)};gPe();var mPe="firebase",vPe="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. - */bm(mPe,vPe,"app");const AX="AIzaSyBbrU8aLBBUyXPYWRSlVBNGYRRq1AcdXQ4",TX="https://eventbuzz-live-default-rtdb.asia-southeast1.firebasedatabase.app";let S1=null;function PX(){return!!(AX.trim()&&TX.trim())}function yPe(){if(!PX())throw new Error("VITE_FIREBASE_API_KEY and VITE_FIREBASE_DATABASE_URL must be set.");return S1||(n9().length?S1=n9()[0]:S1=dQ({apiKey:AX.trim(),databaseURL:TX.trim()})),S1}function xPe(){return pPe(yPe())}function Ww(e){if(typeof e=="number"&&!Number.isNaN(e))return e;const t=Number(e);return Number.isFinite(t)?t:0}function bPe(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:Ww(o.upvotes),down:Ww(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 wPe(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:Ww(n.upvotes),down:Ww(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 SPe(e,t,r){const n=xPe(),o=nPe(n,`sessions/${e}/questions`);return oPe(o,a=>{try{t(bPe(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 nI={listBySession(e){return Ve.get(`/sessions/${e}/questions`)},patch(e,t){return Qg(`/questions/${e}`,{method:"PATCH",body:JSON.stringify(t),skipGlobalLoading:!0})}},jPe=4e3;function kPe(e){return/permission_denied|PERMISSION_DENIED|permission denied/i.test(e)}function _Pe(e){const[t,r]=S.useState([]),[n,o]=S.useState(!0),[a,s]=S.useState(null),l=(e==null?void 0:e.trim())??"";return S.useEffect(()=>{if(!l){r([]),o(!1),s(null);return}let c=!1,u=null,d=null,f=!1;const h=async()=>{var b;const v=await nI.listBySession(l);if(c)return;if(v.error){s(v.error),r([]),o(!1);return}const m=wPe(((b=v.data)==null?void 0:b.questions)??[]);r(m),o(!1),s(null)},p=()=>{f||(f=!0,d&&(d(),d=null),h(),u=setInterval(()=>{c||document.visibilityState!=="visible"||h()},jPe))};return o(!0),s(null),PX()?d=SPe(l,v=>{c||f||(r(v),o(!1),s(null))},v=>{if(c)return;const m=v.message||String(v);if(kPe(m)){p();return}s(m),r([]),o(!1)}):p(),()=>{c=!0,d&&d(),u&&clearInterval(u)}},[l]),{items:t,loading:n,error:a}}function iI(e){return!Number.isNaN(e.getTime())}function oI(e){if(e==null||String(e).trim()==="")return"—";const t=new Date(e);return iI(t)?t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):String(e)}function IX(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 iI(n)?n.toISOString().slice(0,10):""}function CPe(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return"Date TBD";const t=new Date(`${e}T12:00:00`);return iI(t)?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"}):e}function EPe(e){return e===new Date().toISOString().slice(0,10)}function OX(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=IX(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":CPe(n),tracks:Array.from(a.values())}})}function NX(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:oI(n.startTime),dateKey:IX(n.startTime)||"_nodate"});return t.sort((r,n)=>r.startTime.localeCompare(n.startTime)),t}function RX({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 LX({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]=S.useState(o),[l,c]=S.useState(new Set);S.useEffect(()=>{e.length&&o&&s(o)},[e.length,o]);const u=e.find(h=>h.dateKey===a)??e[0];S.useEffect(()=>{const h=e.find(v=>v.dateKey===a)??e[0];if(!(h!=null&&h.tracks.length)){c(new Set);return}const p=h.tracks.map((v,m)=>String(v.trackId??v.trackName??`t-${m}`));c(new Set(p))},[a,e]);const d=h=>{c(p=>{const v=new Set(p);return v.has(h)?v.delete(h):v.add(h),v})};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(pre,{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"&&EPe(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 v=String(h.trackId??h.trackName??`t-${p}`),m=l.has(v);return i.jsxs("div",{style:{borderBottom:pd(v),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(go,{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(b=>i.jsxs("button",{type:"button",onClick:()=>t(b.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:x=>{x.currentTarget.style.background="var(--secondary)"},onMouseLeave:x=>{x.currentTarget.style.background="none"},children:[b.title,i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:2},children:oI(b.startTime)})]},b.sessionId))})]},v)})})]})}function APe(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 $9=["#16a34a","#2563eb","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#ea580c"];function TPe(e){let t=0;for(let r=0;ri.jsxs("button",{type:"button",disabled:b||t,onClick:v,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:b||t?"not-allowed":"pointer",opacity:b||t?.55:1,transition:"all 0.1s"},onMouseEnter:x=>{b||t||(x.currentTarget.style.borderColor=m,x.currentTarget.style.color=m,x.currentTarget.style.background=m+"10")},onMouseLeave:x=>{x.currentTarget.style.borderColor="var(--border)",x.currentTarget.style.color="var(--muted)",x.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:PPe(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(DO,{size:11}),"Remove shortlist",()=>r(!1),"#15803d",d):f(i.jsx(DO,{size:11}),"Shortlist",()=>r(!0),"#15803d",d),e.audienceListed?f(i.jsx(gT,{size:11}),"Hide from audience",()=>n(!1),"#b91c1c",d):f(i.jsx(qh,{size:11}),"Show to audience",()=>n(!0),"#15803d",d),d?f(i.jsx(Kre,{size:11}),"Restore",a,"#2563eb",!1):f(i.jsx(ote,{size:11}),"Archive",o,"#475569",!1)]})]})]})}function FX({fixedSessionId:e=null,compactChrome:t=!1}={}){const n=Si()==="mobile",{selectedEventId:o}=Li(),[a,s]=S.useState(e??null),[l,c]=S.useState([]),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState("All"),[m,b]=S.useState("votes"),[x,w]=S.useState(""),[k,j]=S.useState(!1),[_,T]=S.useState(null),[A,P]=S.useState(null),N=S.useMemo(()=>OX(l),[l]),O=S.useMemo(()=>NX(l),[l]),{items:C,loading:I,error:R}=_Pe(a);S.useEffect(()=>{if(!o){h(null);return}Lr.get(o).then(V=>{var D;(D=V.data)!=null&&D.name?h(V.data.name):h(null)})},[o]),S.useEffect(()=>{if(!o){c([]),s(null);return}d(!0),wa.agendaTree(o).then(V=>{var D;d(!1),c(((D=V.data)==null?void 0:D.tracks)??[])})},[o]),S.useLayoutEffect(()=>{if(e){s(e);return}!o||u||a===null&&O.length===1&&s(O[0].id)},[o,u,a,O,e]);const F=S.useMemo(()=>{const V=C.length,D=C.filter(G=>G.shortlisted).length,z=C.filter(G=>!G.audienceListed).length,q=C.filter(G=>G.status==="archived").length;return{All:V,Shortlisted:D,Hidden:z,Archived:q}},[C]),M=S.useMemo(()=>{let V=C;p==="Shortlisted"?V=V.filter(z=>z.shortlisted):p==="Hidden"?V=V.filter(z=>!z.audienceListed):p==="Archived"&&(V=V.filter(z=>z.status==="archived")),V=V.filter(z=>!x||z.text.toLowerCase().includes(x.toLowerCase())||z.author.toLowerCase().includes(x.toLowerCase()));const D=[...V];return m==="votes"?D.sort((z,q)=>q.up-z.up||(q.createdAt?Date.parse(q.createdAt):0)-(z.createdAt?Date.parse(z.createdAt):0)):D.sort((z,q)=>(q.createdAt?Date.parse(q.createdAt):0)-(z.createdAt?Date.parse(z.createdAt):0)),D},[C,p,x,m]),Y=async(V,D)=>{P(null),T(V);const z=await nI.patch(V,D);T(null),z.error&&P(z.error)},X=["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(Vi,{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 $=!e&&a===null,ee=O.find(V=>V.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:[F.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[F.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[F.Hidden," hidden"]})," · ",i.jsxs("span",{children:[F.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:[F.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[F.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[F.Hidden," hidden"]})," · ",i.jsxs("span",{children:[F.Archived," archived"]})]})]}),!$&&!e?i.jsx("div",{style:{flex:n?1:"none",minWidth:0,maxWidth:n?"100%":360},children:i.jsx(RX,{sessions:O,sessionId:a,onOpenSessionPicker:()=>s(null)})}):null]}),A&&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:A}),$?u?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(LX,{dateGroups:N,onSelectSession:V=>s(V),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:oI(ee.startTime)})]}),R&&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:R}),I&&!R?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:X.map(V=>i.jsxs("button",{type:"button",onClick:()=>v(V),style:{padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",background:p===V?"var(--card)":"transparent",color:p===V?"var(--foreground)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:p===V?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",boxShadow:p===V?"var(--elevation-sm)":"none",display:"flex",alignItems:"center",gap:"5px"},children:[V==="Hidden"?"Hidden from audience":V,F[V]>0&&i.jsx("span",{style:{padding:"0 5px",borderRadius:"999px",background:p===V?"var(--accent)":"transparent",color:p===V?"var(--primary)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:F[V]})]},V))}),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:x,onChange:V=>w(V.target.value),placeholder:"Search questions or authors…",onFocus:()=>j(!0),onBlur:()=>j(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",width:"100%"}}),x&&i.jsx("button",{type:"button",onClick:()=>w(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:11})})]}),i.jsxs("button",{type:"button",onClick:()=>b(V=>V==="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:V=>{V.currentTarget.style.borderColor="var(--primary)",V.currentTarget.style.color="var(--primary)"},onMouseLeave:V=>{V.currentTarget.style.borderColor="var(--border)",V.currentTarget.style.color="var(--muted)"},children:[i.jsx(cte,{size:12}),m==="votes"?"Most upvoted":"Most recent"]})]}),M.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"64px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(dd,{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:x?"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:x?"Try different keywords.":"Audience questions will appear here when submitted for this session."})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:M.map(V=>i.jsx(IPe,{q:V,busy:_===V._id,onShortlist:D=>void Y(V._id,{shortlisted:D}),onAudienceToggle:D=>void Y(V._id,{audienceListed:D}),onArchive:()=>void Y(V._id,{status:"archived"}),onRestore:()=>void Y(V._id,{status:"pending"})},V._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"})})]})}function OPe({active:e,onClick:t,busy:r,disabled:n}){return i.jsx("button",{type:"button",disabled:n||r,onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:e?"#fffbeb":"var(--secondary)",border:`1px solid ${e?"#fcd34d":"var(--border)"}`,cursor:n||r?"not-allowed":"pointer",transition:"all 0.15s",whiteSpace:"nowrap",opacity:n?.45:r?.7:1},children:i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:e?"#b45309":"var(--muted)"},children:e?"Hide Correct":"Show Correct"})})}function NPe({live:e,onClick:t,busy:r}){return i.jsxs("button",{type:"button",disabled:r,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:r?"wait":"pointer",transition:"all 0.15s",whiteSpace:"nowrap",opacity:r?.7:1},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?"Make Offline":"Make Live"})]})}function RPe(e,t){return e._id!=null&&String(e._id).trim()!==""?String(e._id):`q-${t}`}function LPe({quiz:e,onClose:t,onUpdated:r}){var x,w;const[n,o]=S.useState(null),[a,s]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(null),f=((x=e.settings)==null?void 0:x.liveQuestionId)!=null&&String(e.settings.liveQuestionId).trim()!==""?String(e.settings.liveQuestionId).trim():null,h=((w=e.settings)==null?void 0:w.showCorrectAnswer)===!0,p=e.questions||[],v=async k=>{d(null),o(k??"__clear__");const j=await Pi.setLiveQuestion(e._id,k);if(o(null),j.error){d(j.error);return}await r()},m=async()=>{d(null),s(!0);const k=await Pi.setShowCorrect(e._id,!h);if(s(!1),k.error){d(k.error);return}await r()},b=async()=>{d(null),c(!0);const k=await Pi.close(e._id);if(c(!1),k.error){d(k.error);return}await r(),t()};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,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:"quizMasterPanelIn 0.25s ease"},children:[i.jsx("style",{children:"@keyframes quizMasterPanelIn { 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:"Present quiz"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0",lineHeight:1.45},children:e.title}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.45},children:"Make one question live at a time. Attendees only see the live question."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:4},children:i.jsx(Gt,{size:20})})]}),i.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"12px 20px"},children:[u?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginBottom:"12px"},children:u}):null,p.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",padding:"24px 0",textAlign:"center"},children:"No questions on this quiz."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:p.map((k,j)=>{const _=RPe(k,j),T=f===_,A=n===_||n==="__clear__"&&T;return i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"12px 14px",border:`1px solid ${T?"#bbf7d0":"var(--border)"}`,borderRadius:"var(--radius-card)",background:T?"#f0fdf4":"var(--card)"},children:[i.jsx("span",{style:{width:"22px",height:"22px",borderRadius:"50%",background:T?"#16a34a":"var(--accent)",color:T?"#fff":"var(--primary)",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"1px"},children:j+1}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:1.4,marginBottom:"6px"},children:k.question}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",alignItems:"center"},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:k.type||"single"}),typeof k.timeLimit=="number"&&k.timeLimit>0?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[k.timeLimit,"s limit"]}):null,T?i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d",fontWeight:"600"},children:"Live now"}):null]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",flexShrink:0,alignItems:"flex-end"},children:[i.jsx(NPe,{live:T,busy:A,onClick:()=>void v(T?null:_)}),i.jsx(OPe,{active:T&&h,busy:a,disabled:!T,onClick:()=>void m()})]})]},_)})})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0,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)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Close"}),i.jsx("button",{type:"button",disabled:l,onClick:()=>void b(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--destructive)",color:"#fff",cursor:l?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:l?.8:1},children:l?"Taking offline…":"Make quiz offline"})]})]})]})}function Of(e){if(typeof e.enableQnA=="boolean")return e.enableQnA;const t=e.qnaEnabled;return typeof t=="boolean"?t:!0}function ph(e){return typeof e.enableQnP=="boolean"?e.enableQnP:!0}function mx(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,audienceKeyPersonsEnabled:e.audienceKeyPersonsEnabled,audienceMySessionsEnabled:e.audienceMySessionsEnabled,audienceAgendaEnabled:e.audienceAgendaEnabled,audienceFeedbackForm:e.audienceFeedbackForm??null,audienceRatingsForm:e.audienceRatingsForm??null,enableQnA:Of(e),enableQnP:ph(e)}}const FPe=[{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}],zPe={Active:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"var(--secondary)",color:"var(--muted)"},Draft:{bg:"#f3f4f6",color:"#6b7280"}},MPe={1:{bg:"#fef3c7",color:"#92400e",medal:"🥇"},2:{bg:"#f1f5f9",color:"#475569",medal:"🥈"},3:{bg:"#ffedd5",color:"#c2410c",medal:"🥉"}},j1={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 DPe({sessions:e,itemId:t,itemType:r,eventId:n,onClose:o,onDone:a}){const[s,l]=S.useState(""),[c,u]=S.useState(!1),[d,f]=S.useState(!1),[h,p]=S.useState(null);S.useEffect(()=>{t&&(l(""),u(!0),p(null),Pi.get(t).then(m=>{var b;u(!1),(b=m.data)!=null&&b.session?l(String(m.data.session)):e.length&&l(e[0].id)}))},[t,e.length]);const v=async()=>{if(!s||!n)return;f(!0),p(null);const m=await Pi.get(t);if(m.error||!m.data){p(m.error||"Failed to load item"),f(!1);return}const b=m.data,x={session:s,title:(b.title||"").trim()+" (Copy)",type:b.type,description:b.description,questions:(b.questions||[]).map(k=>({question:k.question,type:k.type,imageUrl:k.imageUrl,options:(k.options||[]).map(j=>({text:j.text,isCorrect:j.isCorrect,imageUrl:j.imageUrl})),points:k.points,required:k.required,timeLimit:k.timeLimit})),settings:b.settings?{...b.settings,isLive:!1,liveQuestionId:null,showCorrectAnswer:!1,presentationToken:void 0}:void 0},w=await Pi.create(n,x);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:v,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 U9({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?"Make Offline":"Make Live"})]})}function OE({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(bi,{size:10,strokeWidth:3,color:"#fff"}),e==="indeterminate"&&i.jsx(oS,{size:10,strokeWidth:3,color:"var(--primary)"})]})}function BPe({polls:e,quizzes:t,onClose:r}){const[n,o]=S.useState(new Set),[a,s]=S.useState(new Set),[l,c]=S.useState(!0),[u,d]=S.useState(!1),f=_=>o(T=>{const A=new Set(T);return A.has(_)?A.delete(_):A.add(_),A}),h=_=>s(T=>{const A=new Set(T);return A.has(_)?A.delete(_):A.add(_),A}),p=e.map(_=>_.id),v=t.map(_=>_.id),m=n.size+a.size,b=p.length+v.length,x=n.size===p.length&&a.size===v.length,w=m>0,k=()=>m===0?!1:m===b?!0:"indeterminate",j=()=>{x?(o(new Set),s(new Set)):(o(new Set(p)),s(new Set(v)))};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(nu,{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(Gt,{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(_te,{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(go,{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(OE,{checked:k(),onChange:j}),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 ",b," selected"]})]}),i.jsxs("div",{style:{marginBottom:"14px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[i.jsx(Ad,{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(OE,{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(_$,{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(OE,{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(nu,{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((_,T)=>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:T>1?"right":"left"},children:_},_))}),FPe.map(_=>{const T=MPe[_.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:T?i.jsx("span",{style:{fontSize:"13px"},children:T.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(nu,{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 M6(e){return(e??"").trim()==="quiz_master"}function WPe(e){return(e??"").trim()==="manual"}const H9={display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:"var(--secondary)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.15s",whiteSpace:"nowrap",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)"};function V9({name:e,description:t,badge:r,status:n,live:o,showLiveToggle:a,showQuizMasterControls:s,onToggleLive:l,onPresent:c,onMakeOffline:u,onCopyPresentation:d,presentationCopied:f,onDuplicate:h,onEdit:p,onDelete:v}){const[m,b]=S.useState(!1),x=zPe[n];return i.jsxs("div",{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{display:"flex",alignItems:"center",gap:"12px",padding:"13px 18px",borderBottom:"1px solid var(--border)",background:m?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx(wv,{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:x.bg,color:x.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:[s?i.jsxs(i.Fragment,{children:[o?i.jsx("button",{type:"button",onClick:c,style:H9,children:"Manage"}):i.jsx("button",{type:"button",onClick:c,style:{...H9,color:"var(--primary)",borderColor:"var(--primary)"},children:"Make Live"}),o?i.jsx(U9,{live:!0,onChange:()=>u==null?void 0:u()}):null]}):null,a?i.jsx(U9,{live:o,onChange:l}):null,i.jsx("button",{type:"button",onClick:d,style:j1,title:"Copy presentation link",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:f?i.jsx(bi,{size:12}):i.jsx(Nre,{size:12})}),i.jsx("button",{type:"button",onClick:h,style:j1,title:"Duplicate",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(Js,{size:12})}),i.jsx("button",{type:"button",onClick:p,style:j1,title:"Edit",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:12})}),i.jsx("button",{type:"button",onClick:v,style:{...j1,color:"var(--muted)"},title:"Delete",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--destructive)",w.currentTarget.style.color="var(--destructive)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})}function Y9(e){var a,s,l,c,u,d,f,h;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,showLiveToggle:WPe((f=e.settings)==null?void 0:f.displayMode),showQuizMasterControls:M6((h=e.settings)==null?void 0:h.displayMode),type:e.type==="quiz"?"Quiz":void 0}}const U1={display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"};function NE({icon:e,iconColor:t,title:r,count:n,addLabel:o,onAdd:a,headerActions:s,hideAdd:l,children:c,emptyBody:u}){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)",flexWrap:"wrap"},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}}),s??(!l&&a&&o?i.jsxs("button",{type:"button",onClick:a,style:{...U1,background:t,color:"#fff"},children:[i.jsx(gr,{size:12})," ",o]}):null)]}),u??c]})}function zX({fixedSessionId:e=null,compactChrome:t=!1,includeQnASection:r=!0,onQuizPollPersisted:n}={}){const a=Si()==="mobile",{selectedEventId:s}=Li(),[l,c]=S.useState(e??null),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState(null),[m,b]=S.useState(null),[x,w]=S.useState(null),[k,j]=S.useState(null),[_,T]=S.useState(null),[A,P]=S.useState([]),[N,O]=S.useState([]),[C,I]=S.useState(!1),[R,F]=S.useState(!1),[M,Y]=S.useState(null),[X,$]=S.useState(!1),[ee,V]=S.useState(0),[D,z]=S.useState(!1),[q,G]=S.useState(!1),U=S.useMemo(()=>OX(A),[A]),Q=S.useMemo(()=>NX(A),[A]);S.useEffect(()=>{if(!s){P([]),c(null);return}I(!0),wa.agendaTree(s).then(Ee=>{var Ae;I(!1),P(((Ae=Ee.data)==null?void 0:Ae.tracks)??[])})},[s]),S.useLayoutEffect(()=>{if(e){c(e);return}!s||C||l===null&&Q.length===1&&c(Q[0].id)},[s,C,l,Q,e]);const K=()=>{l&&(F(!0),Pi.listBySession(l).then(Ee=>{var Ae;F(!1),O(((Ae=Ee.data)==null?void 0:Ae.quizPolls)??[])}))};S.useEffect(()=>{if(!l){O([]);return}K()},[l]),S.useEffect(()=>{if(z(!1),!s||!l||!r){Y(null),V(0);return}let Ee=!1;return $(!0),ta.list(s).then(Ae=>{var rt;if(Ee)return;$(!1);const Ye=(((rt=Ae.data)==null?void 0:rt.sessions)??[]).find(He=>He._id===l)??null;Y(Ye)}),nI.listBySession(l).then(Ae=>{var Ye,rt;Ee||V(((rt=(Ye=Ae.data)==null?void 0:Ye.questions)==null?void 0:rt.length)??0)}),()=>{Ee=!0}},[s,l,r]);const re=M?Of(M):!0,H=async Ee=>{if(!(!M||q)){G(!0);try{const Ae=await ta.update(M._id,{...mx(M),enableQnA:Ee});Ae.error||(Y(Ae.data??{...M,enableQnA:Ee}),Ee||z(!1))}finally{G(!1)}}};S.useEffect(()=>{if(!f||f.mode!=="edit"){v(null);return}v(null),Pi.get(f.id).then(Ee=>{if(!Ee.data)return;const Ae=Ee.data,Ye=Ae.type==="quiz"?"quiz":"poll",rt=vle(Ae,ole(Ae.questions));v({kind:Ye,form:rt.form,questions:rt.questions})})},[f]);const ie=S.useMemo(()=>N.filter(Ee=>Ee.type==="poll").map(Y9),[N]),de=S.useMemo(()=>N.filter(Ee=>Ee.type==="quiz").map(Y9),[N]),le=async Ee=>{var rt,He,xt,st;const Ae=N.find(Te=>Te._id===Ee);if(!Ae)return;if(M6((rt=Ae.settings)==null?void 0:rt.displayMode)){w(Ee);return}const Ye=!(((He=Ae.settings)==null?void 0:He.isLive)??((xt=Ae.settings)==null?void 0:xt.isActive));if(await Pi[Ye?"publish":"close"](Ee),l){const Te=await Pi.listBySession(l);O(((st=Te.data)==null?void 0:st.quizPolls)??[])}},ke=async Ee=>{var rt,He,xt,st;const Ae=N.find(Te=>Te._id===Ee);if(!Ae)return;if(M6((rt=Ae.settings)==null?void 0:rt.displayMode)){w(Ee);return}const Ye=!(((He=Ae.settings)==null?void 0:He.isLive)??((xt=Ae.settings)==null?void 0:xt.isActive));if(await Pi[Ye?"publish":"close"](Ee),l){const Te=await Pi.listBySession(l);O(((st=Te.data)==null?void 0:st.quizPolls)??[])}},ve=async Ee=>{await Pi.close(Ee),x===Ee&&w(null),K()},se=async Ee=>{var Ye;T(null);const Ae=await Pi.ensurePresentationToken(Ee);if(Ae.error||!((Ye=Ae.data)!=null&&Ye.presentationUrl)){T(Ae.error??"Could not create presentation link.");return}try{await navigator.clipboard.writeText(Ae.data.presentationUrl),j(Ee),T("Presentation link copied to clipboard."),window.setTimeout(()=>j(null),4e3),window.setTimeout(()=>T(null),4e3)}catch{T("Could not copy to clipboard.")}},be=x?N.find(Ee=>Ee._id===x)??null:null,De=()=>{h(null),v(null)},ae=async Ee=>{if(!s||!l||!f)return;const Ae=f.mode==="create"?f.kind:(p==null?void 0:p.kind)??"poll",Ye=f.mode==="edit"?f.id:null,rt={session:l,title:Ee.form.title,type:Ae,description:Ee.form.description||void 0,questions:Ee.questions.map(xt=>hS(xt,Ae)),settings:gS(Ee.form,Ae)};if(Ye){(await Pi.update(Ye,rt)).error||(K(),De(),await(n==null?void 0:n()));return}(await Pi.create(s,rt)).error||(K(),De(),await(n==null?void 0:n()))},ue=async Ee=>{if(!confirm("Delete this poll? You can restore it later if needed (soft delete)."))return;(await Pi.remove(Ee)).error||K()},Me=async Ee=>{if(!confirm("Delete this quiz? You can restore it later if needed (soft delete)."))return;(await Pi.remove(Ee)).error||K()};if(!s)return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(Vi,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage activities."})]});const Se=!e&&l===null,Pe=Q.find(Ee=>Ee.id===l);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[t?Se?null:i.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:i.jsxs("button",{type:"button",onClick:()=>d(!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(nu,{size:13})," ",a?"Leaderboard":"Session Leaderboard"]})}):i.jsxs("div",{style:{display:"flex",alignItems:a?"stretch":"flex-start",flexDirection:a?"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:"Activities"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Activities"})]}),!Se&&i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:a?"wrap":"nowrap"},children:[e?null:i.jsx("div",{style:{flex:a?1:"none",minWidth:0},children:i.jsx(RX,{sessions:Q,sessionId:l,onOpenSessionPicker:()=>c(null)})}),i.jsxs("button",{type:"button",onClick:()=>d(!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(nu,{size:13})," ",a?"Leaderboard":"Session Leaderboard"]})]})]}),Se?C?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(LX,{dateGroups:U,onSelectSession:Ee=>c(Ee),selectPrompt:"Select a session to manage activities"}):i.jsxs(i.Fragment,{children:[Pe&&!t&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Session: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:Pe.label}),i.jsx("span",{style:{marginLeft:8},children:Pe.trackName})]}),D&&r&&l?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[i.jsxs("button",{type:"button",onClick:()=>z(!1),style:{display:"inline-flex",alignItems:"center",gap:"6px",alignSelf:"flex-start",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:[i.jsx(uT,{size:14})," Back to Activities"]}),i.jsx(FX,{fixedSessionId:l,compactChrome:!0})]}):R?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading activities…"}):i.jsxs(i.Fragment,{children:[_?i.jsx("p",{style:{marginBottom:12,fontSize:"var(--text-sm)",color:"var(--primary)",fontFamily:"var(--font-noto-sans)"},children:_}):null,i.jsx(NE,{icon:i.jsx(Ad,{size:15}),iconColor:"#16a34a",title:"Polls",count:ie.length,addLabel:"Add Poll",onAdd:()=>h({mode:"create",kind:"poll"}),children:ie.map(Ee=>i.jsx(V9,{name:Ee.name,description:Ee.description,status:Ee.status,live:Ee.live,showLiveToggle:Ee.showLiveToggle,showQuizMasterControls:Ee.showQuizMasterControls,onToggleLive:()=>void le(Ee.id),onPresent:()=>w(Ee.id),onMakeOffline:()=>void ve(Ee.id),onCopyPresentation:()=>void se(Ee.id),presentationCopied:k===Ee.id,onDuplicate:()=>b({id:Ee.id,type:"poll"}),onEdit:()=>h({mode:"edit",id:Ee.id}),onDelete:()=>ue(Ee.id)},Ee.id))}),i.jsx(NE,{icon:i.jsx(_$,{size:15}),iconColor:"var(--primary)",title:"Quizzes",count:de.length,addLabel:"Add Quiz",onAdd:()=>h({mode:"create",kind:"quiz"}),children:de.map(Ee=>i.jsx(V9,{name:Ee.name,description:Ee.description,badge:Ee.type,status:Ee.status,live:Ee.live,showLiveToggle:Ee.showLiveToggle,showQuizMasterControls:Ee.showQuizMasterControls,onToggleLive:()=>void ke(Ee.id),onPresent:()=>w(Ee.id),onMakeOffline:()=>void ve(Ee.id),onCopyPresentation:()=>void se(Ee.id),presentationCopied:k===Ee.id,onDuplicate:()=>b({id:Ee.id,type:"quiz"}),onEdit:()=>h({mode:"edit",id:Ee.id}),onDelete:()=>Me(Ee.id)},Ee.id))}),r?i.jsx(NE,{icon:i.jsx(dd,{size:15}),iconColor:"#7c3aed",title:"Q&A",count:ee,hideAdd:!0,headerActions:i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:re?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:q||X,onClick:()=>void H(!1),style:{...U1,background:"var(--card)",color:"var(--muted)",border:"1px solid var(--border)",cursor:q?"wait":"pointer"},children:"Disable"}),i.jsx("button",{type:"button",onClick:()=>z(!0),style:{...U1,background:"#7c3aed",color:"#fff"},children:"Manage"})]}):i.jsx("button",{type:"button",disabled:q||X||!M,onClick:()=>void H(!0),style:{...U1,background:"#7c3aed",color:"#fff",cursor:q||!M?"wait":"pointer",opacity:M?1:.6},children:q?"Enabling…":"Enable"})}),emptyBody:i.jsx("div",{style:{padding:"16px 18px"},children:i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.5},children:re?"Audience questions are enabled on the visitor session page. Use Manage to moderate submitted questions.":"Controls whether attendees can ask and view questions on the visitor session page."})})}):null]})]}),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"})}),u&&i.jsx(BPe,{polls:ie,quizzes:de,onClose:()=>d(!1)}),f&&(f.mode==="create"||p)&&i.jsx(Ax,{kind:f.mode==="create"?f.kind:p.kind,initial:f.mode==="edit"?{form:p.form,questions:p.questions}:void 0,eventId:s,onClose:De,onSave:Ee=>void ae(Ee)},f.mode==="edit"?f.id:`new-${f.kind}`),m&&s&&Q.length>0&&i.jsx(DPe,{sessions:Q,itemId:m.id,itemType:m.type,eventId:s,onClose:()=>b(null),onDone:K}),be?i.jsx(LPe,{quiz:be,onClose:()=>w(null),onUpdated:async()=>{K()}}):null]})}function qPe(e={}){return i.jsx(zX,{...e,includeQnASection:e.includeQnASection??!1})}function $Pe({event:e,session:t,selectedEventId:r,onSaved:n}){const[o,a]=S.useState(1),[s,l]=S.useState(()=>new Set([1,2,3,4])),[c,u]=S.useState(()=>c2(e)),[d,f]=S.useState(()=>Of(t)),[h,p]=S.useState(()=>ph(t)),[v,m]=S.useState({}),[b,x]=S.useState(!1),[w,k]=S.useState(null),j=S.useRef(null),_=S.useRef(null);S.useEffect(()=>{u(c2(e)),f(Of(t)),p(ph(t)),m({}),k(null)},[e._id,e.updatedAt,t._id,t]);const T=S.useCallback((V,D)=>{u(z=>({...z,[V]:D}))},[]),A=V=>v[V],P=V=>a(D=>D===V?0:V),N=()=>u(V=>({...V,customFields:[...V.customFields,BU()]})),O=V=>{u(D=>({...D,customFields:D.customFields.filter(z=>z.id!==V)})),m(D=>{const z={...D};return Object.keys(z).forEach(q=>{(q.startsWith(`cf_${V}_`)||q===`cf_${V}_label`)&&delete z[q]}),z})},C=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>{if(q.id!==V)return q;const G={...q,label:D};return q.codeAuto&&(G.code=Ch(D)),G})}))},I=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>q.id===V?{...q,code:D,codeAuto:!1}:q)}))},R=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>{if(q.id!==V)return q;const G={...q,fieldType:D};return sc(D)&&q.options.length===0&&(G.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),sc(D)||(G.options=[]),G})}))},F=V=>{u(D=>({...D,customFields:D.customFields.map(z=>z.id===V?{...z,options:[...z.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:z)}))},M=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>q.id===V?{...q,options:q.options.filter(G=>G.id!==D)}:q)})),m(z=>{const q={...z};return delete q[`cf_${V}_opt_${D}`],q})},Y=(V,D,z,q)=>{u(G=>({...G,customFields:G.customFields.map(U=>U.id===V?{...U,options:U.options.map(Q=>Q.id===D?{...Q,[z]:q}:Q)}:U)}))},X=V=>{k(null),m({}),l(D=>new Set([...D,V])),V{k(null);const V=mae(c,e),D=V.customFields.filter(G=>!(!G.label.trim()||sc(G.fieldType)&&G.options.filter(Q=>Q.label.trim()&&Q.value.trim()).length===0)),z={...V,customFields:D},q=vae(z);if(Object.keys(q).length>0){m(q),(q.virtualLink||q.endDate)&&a(2),k("Fix the highlighted fields, then save again.");return}m({}),x(!0);try{const U={...zU(z),recordKind:e.recordKind??"activity",activitySubtype:e.activitySubtype},Q=await Lr.update(r,U);if(Q.error){k(Q.error);return}const K=await ta.update(t._id,{...mx(t),enableQnA:d,enableQnP:h});if(K.error){k(K.error);return}k("Saved."),await n()}finally{x(!1)}},ee=Math.round(s.size/pm*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:b,onClick:()=>void $(),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:b?"var(--secondary)":"var(--primary)",color:b?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:b?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:b?"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 ",pm," 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(Tf,{n:1,title:"Basic",subtitle:"Name, description, and session features",open:o===1,completed:s.has(1),onToggle:()=>P(1),onNext:()=>X(1),nextLabel:"Continue to Schedule & Location",nextDisabled:b,children:[i.jsxs(lr,{error:A("eventName"),children:[i.jsx(ur,{text:"Activity name"}),i.jsx("input",{style:{...Qr,...A("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:V=>T("eventName",V.target.value)})]}),i.jsxs(lr,{error:A("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"80px",...A("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:V=>T("description",V.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:V=>f(V.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:V=>p(V.target.checked)}),"Enable quiz & polls (Quiz & Polls tab)"]})]}),i.jsxs(Tf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>P(2),onNext:()=>X(2),nextLabel:"Continue to Media & Tags",nextDisabled:b,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:A("status"),children:[i.jsx(ur,{text:"Status"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:V=>T("status",V.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:A("locationType"),children:[i.jsx(ur,{text:"Location Type"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:V=>T("locationType",V.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:A("venue"),children:[i.jsx(ur,{text:"Venue / Address"}),i.jsx("input",{style:{...Qr,...A("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:V=>T("venue",V.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:A("virtualLink"),children:[i.jsx(ur,{text:"Virtual link"}),i.jsx("input",{style:{...Qr,...A("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:V=>T("virtualLink",V.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A("startDate"),children:[i.jsx(ur,{text:"Start Date"}),i.jsx("input",{type:"date",style:{...Qr,...A("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:V=>T("startDate",V.target.value)})]}),i.jsxs(lr,{error:A("endDate"),children:[i.jsx(ur,{text:"End Date"}),i.jsx("input",{type:"date",style:{...Qr,...A("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:V=>T("endDate",V.target.value)})]})]})]}),i.jsxs(Tf,{n:3,title:"Media & Tags",subtitle:"Logo, banner, and tags",open:o===3,completed:s.has(3),onToggle:()=>P(3),onNext:()=>X(3),nextLabel:"Continue to Registration & Form Fields",nextDisabled:b,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:{...Qr,paddingLeft:"30px"},placeholder:"Comma-separated",value:c.keyPeople,onChange:V=>T("keyPeople",V.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Event Logo"}),i.jsx(l2,{label:"logo",preview:c.eventLogo,error:A("eventLogo"),inputRef:j,onFile:V=>{T("eventLogo",V),m(D=>{const z={...D};return delete z.eventLogo,z})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner Image"}),i.jsx(l2,{label:"banner",preview:c.eventBanner,error:A("eventBanner"),inputRef:_,onFile:V=>{T("eventBanner",V),m(D=>{const z={...D};return delete z.eventBanner,z})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback"}),i.jsx(Af,{name:"enableFeedback",value:c.enableFeedback,onChange:V=>T("enableFeedback",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings"}),i.jsx(Af,{name:"enableRatings",value:c.enableRatings,onChange:V=>T("enableRatings",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Tf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>P(4),onNext:()=>void $(),nextLabel:"Save settings",nextDisabled:b,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(Af,{name:"regRequired",value:c.registrationRequired,onChange:V=>T("registrationRequired",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:A("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:V=>T("registrationMode",V.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(Af,{name:"verifyEmail",value:c.verifyEmail,onChange:V=>T("verifyEmail",V),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:Qr,value:c.registrationDeadline,onChange:V=>T("registrationDeadline",V.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:V=>T("authenticationType",V.target.value),disabled:c.registrationRequired!=="Yes",children:NT.map(V=>i.jsx("option",{value:V.value,children:V.label},V.value))})})]}),i.jsxs(lr,{error:A("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:V=>T("registrationBaseFields",V.target.value),disabled:c.registrationRequired!=="Yes",children:RT.map(V=>i.jsx("option",{value:V.value,children:V.label},V.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((V,D)=>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 ",D+1]}),i.jsx("button",{type:"button",onClick:()=>O(V.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(Xr,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A(`cf_${V.id}_label`),children:[i.jsx(ur,{text:"Field Label"}),i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:V.label,onChange:z=>C(V.id,z.target.value)})]}),i.jsxs(lr,{error:A(`cf_${V.id}_code`),children:[i.jsx(ur,{text:"Field Code"}),i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:V.codeAuto?.92:1},placeholder:"auto from label",value:V.code||(V.codeAuto?Ch(V.label):""),onChange:z=>I(V.id,z.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:A(`cf_${V.id}_type`),children:[i.jsx(ur,{text:"Field Type"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A(`cf_${V.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:V.fieldType,onChange:z=>R(V.id,z.target.value),children:OT.map(z=>i.jsx("option",{value:z.value,children:z.label},z.value))})})]}),sc(V.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)"}),A(`cf_${V.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:A(`cf_${V.id}_options`)}),V.options.map(z=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:A(`cf_${V.id}_opt_${z.id}`),children:i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_opt_${z.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:z.value,onChange:q=>Y(V.id,z.id,"value",q.target.value)})}),i.jsx(lr,{error:A(`cf_${V.id}_opt_${z.id}`),children:i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_opt_${z.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:z.label,onChange:q=>Y(V.id,z.id,"label",q.target.value)})}),i.jsx("button",{type:"button",onClick:()=>M(V.id,z.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(Xr,{size:14})})]},z.id)),i.jsxs("button",{type:"button",onClick:()=>F(V.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(gr,{size:12})," Add option"]})]})]},V.id)),i.jsxs("button",{type:"button",onClick:N,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(gr,{size:13})," Add custom field"]})]})]})]})]})}function UPe(e,t){return hS(e,t)}function HPe(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 VPe(){var F,M,Y,X;const{selectedEventId:e,setActiveNav:t}=Li(),n=Si()==="mobile",[o,a]=S.useState(null),[s,l]=S.useState(null),[c,u]=S.useState(!0),[d,f]=S.useState(null),[h,p]=S.useState("questions"),[v,m]=S.useState(!1),[b,x]=S.useState(!1),[w,k]=S.useState(null),j=S.useCallback(async()=>{var $;if(e){u(!0),f(null);try{const[ee,V]=await Promise.all([Lr.get(e),ta.list(e)]);if(ee.error||!ee.data){f(ee.error||"Could not load activity."),a(null),l(null);return}const D=ee.data;a(D);const q=((($=V.data)==null?void 0:$.sessions)??[])[0]??null;l(q)}finally{u(!1)}}},[e]);S.useEffect(()=>{j()},[j]);const _=s?Of(s):!0,T=s?ph(s):!0,A=S.useMemo(()=>{const $=[];return _&&$.push({id:"questions",label:"Questions"}),T&&$.push({id:"quiz-polls",label:"Quiz & Polls"}),$.push({id:"participants",label:"Participants"},{id:"settings",label:"Settings"}),$},[_,T]);S.useEffect(()=>{var $;A.some(ee=>ee.id===h)||p((($=A[0])==null?void 0:$.id)??"participants")},[A,h]),o&&HPe(o);const P=s?Of(s):!0,N=s?ph(s):!0;o!=null&&o.activitySubtype;const O=async()=>{if(!(!s||b)){x(!0);try{(await ta.update(s._id,{...mx(s),enableQnA:!0,enableQnP:ph(s)})).error||await j()}finally{x(!1)}}},C=S.useCallback(async()=>{if(!s||ph(s))return;(await ta.update(s._id,{...mx(s),enableQnP:!0,enableQnA:Of(s)})).error||await j()},[s,j]),I=S.useMemo(()=>{var ee;if(!w||!o)return;const $=qT();return $.title=(ee=o.name)!=null&&ee.trim()?o.name.trim().slice(0,200):w==="quiz"?"New quiz":"New poll",{form:$,questions:[]}},[w,o]),R=async $=>{if(!e||!s||!w)return;const ee=w,V={session:s._id,title:$.form.title,type:ee,description:$.form.description||void 0,questions:$.questions.map(q=>UPe(q,ee)),settings:gS($.form,ee)};if((await Pi.create(e,V)).error)return;k(null),(await ta.update(s._id,{...mx(s),enableQnP:!0,enableQnA:Of(s)})).error||await j()};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:!((F=s.joinCode)!=null&&F.trim()),title:(M=s.joinCode)!=null&&M.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:(Y=s.joinCode)!=null&&Y.trim()?"pointer":"not-allowed",flexShrink:0,opacity:(X=s.joinCode)!=null&&X.trim()?1:.55,transition:"all 0.15s"},onMouseEnter:$=>{var V;if(!((V=s.joinCode)!=null&&V.trim()))return;const ee=$.currentTarget;ee.style.background="var(--secondary)",ee.style.borderColor="var(--primary)",ee.style.color="var(--primary)"},onMouseLeave:$=>{var V;if(!((V=s.joinCode)!=null&&V.trim()))return;const ee=$.currentTarget;ee.style.background="var(--card)",ee.style.borderColor="var(--border)",ee.style.color="var(--card-foreground)"},children:[i.jsx(Zf,{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:A.map($=>i.jsx("button",{type:"button",onClick:()=>p($.id),style:{padding:n?"10px 16px":"12px 24px",background:"none",border:"none",borderBottom:h===$.id?"2px solid var(--primary)":"2px solid transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:h===$.id?"var(--font-weight-medium)":"var(--font-weight-normal)",color:h===$.id?"var(--primary)":"var(--card-foreground)",transition:"all 0.15s"},children:$.label},$.id))})}),i.jsxs("div",{style:{minHeight:"240px"},children:[h==="questions"&&_?i.jsx(FX,{fixedSessionId:s._id,compactChrome:!0}):null,h==="quiz-polls"&&T?i.jsx(qPe,{fixedSessionId:s._id,compactChrome:!0,onQuizPollPersisted:C}):null,h==="participants"?i.jsx(VG,{compactChrome:!0}):null,h==="settings"?i.jsx("div",{style:{padding:"20px"},children:i.jsx($Pe,{event:o,session:s,selectedEventId:e,onSaved:j})}):null]}),!P||!N?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"}),P?null:i.jsxs("div",{style:{marginBottom:N?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:b,onClick:()=>void O(),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:b?"wait":"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:b?.85:1},children:b?"Enabling…":"Enable Q&A"})]}),N?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&&I?i.jsx(Ax,{kind:w,initial:I,eventId:e,onClose:()=>k(null),onSave:$=>void R($)},w):null,i.jsx(FT,{open:v,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 aI=["Moderator","Presenter","Co-organiser","Viewer"];function MX(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 G9=["#f97316","#16a34a","#7c3aed","#0891b2","#be185d","#0d9488"];function D6(e){let t=0;for(let r=0;rt.sessions.map(r=>r.sessionId))}function sI({tracks:e,selected:t,onToggle:r,onSelectGroup:n,onSelectAll:o}){const a=S.useMemo(()=>pj(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(bi,{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(oS,{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(RE,{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(RE,{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(RE,{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 YPe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=S.useState("users"),[a,s]=S.useState([]),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(!1),[p,v]=S.useState(null),[m,b]=S.useState(new Set),[x,w]=S.useState("Viewer"),[k,j]=S.useState(new Set),_=S.useMemo(()=>pj(l),[l]);S.useEffect(()=>{let I=!1;return d(!0),Promise.all([wa.listAvailableUsers(e),wa.agendaTree(e)]).then(([R,F])=>{var M,Y;I||(d(!1),(M=R.data)!=null&&M.users&&s(R.data.users),(Y=F.data)!=null&&Y.tracks&&c(F.data.tracks))}),()=>{I=!0}},[e]);const T=I=>{b(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},A=I=>{j(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},P=(I,R)=>{j(F=>{const M=new Set(F);return I.forEach(Y=>R?M.add(Y):M.delete(Y)),M})},N=I=>j(I?new Set(_):new Set),O=m.size>0&&x,C=async()=>{v(null),h(!0);const I=await wa.addStaff(e,{userIds:Array.from(m),sessionIds:Array.from(k),eventRole:x});if(h(!1),I.error){v(I.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(Gt,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((I,R)=>i.jsxs("button",{type:"button",onClick:()=>o(I),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${n===I?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:n===I?600:400,color:n===I?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:n===I?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:R+1}),I==="users"?"Users & role":"Session access"]},I))}),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:x,onChange:I=>w(I.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:aI.map(I=>i.jsx("option",{value:I,children:I},I))})}),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(I=>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(I._id),onChange:()=>T(I._id)}),i.jsx(B6,{initials:MX(I.firstName,I.lastName,I.email),color:D6(I.email),size:28}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:500},children:[I.firstName,I.lastName].filter(Boolean).join(" ")||I.email}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:I.email})]},I._id))})]}):i.jsx(sI,{tracks:l,selected:k,onToggle:A,onSelectGroup:P,onSelectAll:N})}),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:!O,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:O?"var(--primary)":"var(--border)",color:O?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:O?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsx("button",{type:"button",onClick:C,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 GPe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=S.useState([{id:"r1",email:"",role:"Viewer"}]),[a,s]=S.useState("users"),[l,c]=S.useState([]),[u,d]=S.useState(new Set),[f,h]=S.useState(!1),[p,v]=S.useState(!1),[m,b]=S.useState(null),x=S.useMemo(()=>pj(l),[l]);S.useEffect(()=>{a==="sessions"&&(h(!0),wa.agendaTree(e).then(C=>{var I;h(!1),(I=C.data)!=null&&I.tracks&&c(C.data.tracks)}))},[e,a]);const w=()=>o(C=>[...C,{id:`r${Date.now()}`,email:"",role:"Viewer"}]),k=C=>o(I=>I.filter(R=>R.id!==C)),j=(C,I,R)=>o(F=>F.map(M=>M.id===C?{...M,[I]:R}:M)),_=C=>d(I=>{const R=new Set(I);return R.has(C)?R.delete(C):R.add(C),R}),T=(C,I)=>d(R=>{const F=new Set(R);return C.forEach(M=>I?F.add(M):F.delete(M)),F}),A=C=>d(C?new Set(x):new Set),P=n.filter(C=>C.email.trim()&&C.role),N=P.length>0,O=async()=>{var I;b(null),v(!0);const C=await wa.sendInvites(e,{invites:P.map(R=>({email:R.email.trim(),eventRole:R.role||"Viewer"})),sessionIds:Array.from(u)});v(!1),C.data&&b(C.data),!(C.error&&!C.data)&&C.data&&(C.data.sent>0||((I=C.data.errors)==null?void 0:I.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(Gt,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((C,I)=>i.jsxs("button",{type:"button",onClick:()=>s(C),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${a===C?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:a===C?600:400,color:a===C?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:a===C?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:I+1}),C==="users"?"Emails & roles":"Session access"]},C))}),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(C=>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:C.email,onChange:I=>j(C.id,"email",I.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:C.role,onChange:I=>j(C.id,"role",I.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:aI.map(I=>i.jsx("option",{value:I,children:I},I))})]}),n.length>1&&i.jsx("button",{type:"button",onClick:()=>k(C.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(Gt,{size:12})})]},C.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(yT,{size:13})," Add another"]})]}),a==="sessions"&&(f?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(sI,{tracks:l,selected:u,onToggle:_,onSelectGroup:T,onSelectAll:A}))]}),(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((C,I)=>i.jsxs("div",{children:[C.email,": ",C.message]},I))}),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:!N,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:N?"var(--primary)":"var(--border)",color:N?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:N?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsxs("button",{type:"button",onClick:O,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(b$,{size:13})," Send invitations"]})]})]})]})})}function KPe({eventId:e,member:t,onClose:r,onSuccess:n}){const[o,a]=S.useState([]),[s,l]=S.useState(!0),[c,u]=S.useState(!1),[d,f]=S.useState(new Set(t.sessionIds)),[h,p]=S.useState(t.eventRole||"Viewer"),v=S.useMemo(()=>pj(o),[o]);S.useEffect(()=>{wa.agendaTree(e).then(k=>{var j;l(!1),(j=k.data)!=null&&j.tracks&&a(k.data.tracks)})},[e]);const m=k=>f(j=>{const _=new Set(j);return _.has(k)?_.delete(k):_.add(k),_}),b=(k,j)=>f(_=>{const T=new Set(_);return k.forEach(A=>j?T.add(A):T.delete(A)),T}),x=k=>f(k?new Set(v):new Set),w=async()=>{u(!0);const k=await wa.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(Gt,{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:aI.map(k=>i.jsx("option",{value:k,children:k},k))})]}),s?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(sI,{tracks:o,selected:d,onToggle:m,onSelectGroup:b,onSelectAll:x})]}),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 QPe(){const{selectedEventId:e,permissionsOpenAddOnce:t,setPermissionsOpenAddOnce:r}=Li(),[n,o]=S.useState(null),[a,s]=S.useState([]),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(!1),[p,v]=S.useState(""),[m,b]=S.useState(null),[x,w]=S.useState(!1),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState(null),N=async()=>{var X;if(!e){d(!1),s([]),c([]),o(null);return}d(!0),h(!1);const[M,Y]=await Promise.all([Lr.get(e),wa.listStaff(e)]);if(d(!1),(X=M.data)!=null&&X.name&&o(M.data.name),Y.error){Y.status===403&&h(!0);return}Y.data&&(s(Y.data.members??[]),c(Y.data.invites??[]))};S.useEffect(()=>{N()},[e]),S.useEffect(()=>{t&&(j(!0),r(!1))},[t,r]);const O=S.useMemo(()=>{if(!p.trim())return a;const M=p.toLowerCase();return a.filter(Y=>Y.email.toLowerCase().includes(M)||[Y.firstName,Y.lastName].filter(Boolean).join(" ").toLowerCase().includes(M))},[a,p]),C=S.useMemo(()=>p.trim()?l.filter(M=>M.email.toLowerCase().includes(p.toLowerCase())):l,[l,p]),I=async M=>{if(!e||!confirm("Remove this user from the event?"))return;(await wa.removeStaff(e,M)).error||N()},R=async M=>{e&&(await wa.resendInvite(e,M),N())},F=async M=>{if(!e||!confirm("Cancel this invitation?"))return;(await wa.cancelInvite(e,M)).error||N()};return e?f?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(fd,{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:n??"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:[a.length," member",a.length!==1?"s":""," · ",l.length," pending invite",l.length!==1?"s":""]})]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",onClick:()=>j(!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(Ri,{size:14})," Add users"]}),i.jsxs("button",{type:"button",onClick:()=>T(!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(yT,{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 ${x?"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:p,onChange:M=>v(M.target.value),placeholder:"Search by name or email…",onFocus:()=>w(!0),onBlur:()=>w(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{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(M=>i.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:M},M))}),u?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading…"}):O.length===0&&C.length===0?i.jsxs("div",{style:{padding:"48px 20px",textAlign:"center"},children:[i.jsx(fd,{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:[O.map(M=>i.jsxs("div",{onMouseEnter:()=>b(M.userId),onMouseLeave:()=>b(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:m===M.userId?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(B6,{initials:MX(M.firstName,M.lastName,M.email),color:D6(M.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:[M.firstName,M.lastName].filter(Boolean).join(" ")||M.email})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:M.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:M.eventRole||"Viewer"}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:m===M.userId?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>P(M),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(wi,{size:12})," Edit"]}),i.jsx("button",{type:"button",onClick:()=>I(M.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(Xr,{size:12})})]})]},M.userId)),C.map(M=>i.jsxs("div",{onMouseEnter:()=>b(`inv-${M.id}`),onMouseLeave:()=>b(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:m===`inv-${M.id}`?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(B6,{initials:M.email.slice(0,2).toUpperCase(),color:D6(M.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:M.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:M.eventRole}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:m===`inv-${M.id}`?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>R(M.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(b$,{size:12})," Resend"]}),i.jsx("button",{type:"button",onClick:()=>F(M.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(Xr,{size:12})})]})]},M.id))]})]}),k&&e&&i.jsx(YPe,{eventId:e,onClose:()=>j(!1),onSuccess:N}),_&&e&&i.jsx(GPe,{eventId:e,onClose:()=>T(!1),onSuccess:N}),A&&e&&i.jsx(KPe,{eventId:e,member:A,onClose:()=>P(null),onSuccess:N})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(fd,{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."})]})}function yh(e){const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return t||(e.email?e.email:"Participant")}function XPe({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(nu,{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:yh(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:yh(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 ZPe({row:e,onClose:t,onSubmit:r,loading:n}){const[o,a]=S.useState(5),[s,l]=S.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(Gt,{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:yh(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:yh(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(gr,{size:13})," Add ",o," pts"]})]})]})})}function JPe({eventId:e}){var N;const[t,r]=S.useState(null),[n,o]=S.useState(null),[a,s]=S.useState([]),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(!1),[p,v]=S.useState(""),[m,b]=S.useState(!1),[x,w]=S.useState(null),k=S.useCallback(async()=>{var O;if(!e){o(null),s([]);return}d(!0),c(null);try{const[C,I]=await Promise.all([Lr.get(e),FO.leaderboard(e,200)]);if(C.error){c(C.error),o(null),s([]);return}o(C.data??null);const R=((O=I.data)==null?void 0:O.leaderboard)??[];if(I.error){c(I.error),s([]);return}s(R)}finally{d(!1)}},[e]);S.useEffect(()=>{k()},[k]);const j=S.useMemo(()=>{const O=p.trim().toLowerCase();return O?a.filter(C=>{const I=yh(C).toLowerCase(),R=(C.email||"").toLowerCase();return I.includes(O)||R.includes(O)}):a},[a,p]),_=j.slice(0,3),T=Math.max(((N=j[0])==null?void 0:N.total)??1,1),A=()=>{const O=[["rank","name","email","net_points"].join(",")];j.forEach((F,M)=>{const Y=yh(F).replace(/"/g,'""'),X=(F.email||"").replace(/"/g,'""');O.push(`${M+1},"${Y}","${X}",${F.total}`)});const C=new Blob([O.join(` -`)],{type:"text/csv"}),I=URL.createObjectURL(C),R=document.createElement("a");R.href=I,R.download=`reward-leaderboard-${e||"event"}.csv`,R.click(),URL.revokeObjectURL(I)},P=async(O,C)=>{if(!(!e||!t)){h(!0);try{await FO.create(e,{participant:t.participantId,points:Math.max(1,Math.floor(O)),type:"earned",source:"manual",description:C||void 0}),r(null),await k()}finally{h(!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:u?"Loading…":(n==null?void 0:n.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:l?i.jsx("span",{style:{color:"var(--destructive)"},children:l}):`${a.length} on leaderboard · Net score (earned − redeemed)`})]}),i.jsx("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:i.jsxs("button",{type:"button",onClick:A,disabled:!j.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:j.length?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",opacity:j.length?1:.5},children:[i.jsx(ja,{size:13})," Export CSV"]})})]}),i.jsx(XPe,{top3:_}),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 ${m?"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:p,onChange:O=>v(O.target.value),placeholder:"Search…",onFocus:()=>b(!0),onBlur:()=>b(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{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(O=>i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em"},children:O},O))}),!j.length&&!u?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."}):j.map((O,C)=>{const I=C+1,R=I<=3,F=O.total/T;return i.jsxs("div",{onMouseEnter:()=>w(C),onMouseLeave:()=>w(null),style:{display:"grid",gridTemplateColumns:"56px 1fr 1.6fr 80px 120px",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:x===C?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("div",{children:I===1?i.jsx("span",{style:{fontSize:"16px"},children:"🥇"}):I===2?i.jsx("span",{style:{fontSize:"16px"},children:"🥈"}):I===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:["#",I]})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:R?"var(--font-weight-medium)":"var(--font-weight-normal)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:yh(O)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.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:O.total}),i.jsx("div",{style:{flex:1,height:"3px",background:"var(--border)",borderRadius:"999px",overflow:"hidden"},children:i.jsx("div",{style:{width:`${Math.round(F*100)}%`,height:"100%",background:"var(--primary)",opacity:.5,borderRadius:"999px"}})})]}),i.jsx("div",{style:{opacity:x===C?1:0,transition:"opacity 0.15s"},children:i.jsxs("button",{type:"button",onClick:()=>r(O),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(gr,{size:11})," Add points"]})})]},O.participantId)})]}),t&&i.jsx(ZPe,{row:t,onClose:()=>r(null),onSubmit:P,loading:f})]}):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 DX(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 Xo={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em"};function e8e(e,t){return`${t} ${(e/100).toFixed(2)}`}const K9="__eb_payment_cancelled__";function t8e(){var je,xe;const{user:e}=Mr(),{selectedEventId:t}=Li(),r=Nn(e),[n,o]=S.useState([]),[a,s]=S.useState(!0),[l,c]=S.useState(null),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(!1),[m,b]=S.useState(null),[x,w]=S.useState(!1),[k,j]=S.useState(""),[_,T]=S.useState(""),[A,P]=S.useState([""]),[N,O]=S.useState(""),[C,I]=S.useState("INR"),[R,F]=S.useState(0),[M,Y]=S.useState(""),[X,$]=S.useState(""),[ee,V]=S.useState(""),[D,z]=S.useState([]),[q,G]=S.useState(null),[U,Q]=S.useState(!1),[K,re]=S.useState(null),[H,ie]=S.useState(!1),[de,le]=S.useState(!1),[ke,ve]=S.useState(""),[se,be]=S.useState("upload"),[De,ae]=S.useState(""),[ue,Me]=S.useState(""),[Se,Pe]=S.useState(""),[Ee,Ae]=S.useState(""),[Ye,rt]=S.useState(""),[He,xt]=S.useState([]),[st,Te]=S.useState(!1),[et,Pt]=S.useState(!1),qe=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",Et=typeof window<"u"&&t?`${window.location.origin}/event/${t}/tickets`:"",vt=S.useCallback(async()=>{var Re;if(!t||!r){o([]),s(!1);return}s(!0),c(null);try{const[ze,Le,Qe]=await Promise.all([Ky.list(t),qa.list({organization:r}),Mo.listForEvent(t)]);if(o(ze),Le.error)throw new Error(Le.error);d((((Re=Le.data)==null?void 0:Re.lists)??[]).filter(mt=>mt.type==="fixed")),h(Qe)}catch(ze){c(ze instanceof Error?ze.message:"Failed to load"),o([])}finally{s(!1)}},[t,r]);S.useEffect(()=>{vt()},[vt]);const Ft=S.useCallback(async()=>{var Re,ze;if(!t){G(null);return}Q(!0),re(null);try{const[Le,Qe]=await Promise.all([d5.get(t),Lr.get(t)]);ve(((ze=(Re=Qe.data)==null?void 0:Re.name)==null?void 0:ze.trim())||""),G(Le),le(Le.enabled),be(Le.manualQrMode==="dynamic"?"dynamic":"upload"),Me(Le.upiQrImageUrl||""),Pe(Le.upiId||""),Ae(Le.payeeName||""),rt(Le.instructions||"");const mt=await z0.list(t,"pending_review");xt(mt)}catch(Le){re(Le instanceof Error?Le.message:"Failed to load UPI settings"),G(null)}finally{Q(!1)}},[t]);S.useEffect(()=>{Ft()},[Ft]),S.useEffect(()=>{var It,Bt;if(se!=="dynamic"||!Se.trim()||!ke.trim()){ae("");return}const ze=`${((It=n[0])==null?void 0:It.name)||"Sample ticket"} · ${ke}`.slice(0,99),Qe=((((Bt=n[0])==null?void 0:Bt.basePriceMinor)??1e4)/100).toFixed(2),mt=DX({pa:Se.trim(),pn:ze,am:Qe});if(!mt){ae("");return}let ft=!1;return _v.toDataURL(mt,{margin:1,width:220,errorCorrectionLevel:"M"}).then(dr=>{ft||ae(dr)}),()=>{ft=!0}},[se,Se,ke,n]);const Ce=async()=>{if(t){Te(!0);try{xt(await z0.list(t,"pending_review"))}catch{}finally{Te(!1)}}},lt=async()=>{if(t){ie(!0);try{const Re={enabled:de,manualQrMode:se,upiQrImageUrl:ue.trim(),upiId:Se.trim(),payeeName:Ee.trim(),instructions:Ye,platformFeeInr:null},ze=await d5.patch(t,Re);G(ze),le(ze.enabled),be(ze.manualQrMode==="dynamic"?"dynamic":"upload"),Me(ze.upiQrImageUrl||""),await Ce()}catch(Re){window.alert(Re instanceof Error?Re.message:"Save failed")}finally{ie(!1)}}},Xe=async()=>{if(!(!t||!qe)){Pt(!0);try{await cT();const Re=await d5.checkoutEnablementOrder(t),ze=window.Razorpay;await new Promise((Le,Qe)=>{let mt=!1;const ft=new ze({key:Re.keyId,amount:Re.amount,currency:Re.currency,order_id:Re.orderId,name:"EventBuzz",description:"Manual UPI ticketing — enablement fee",handler:It=>{mt=!0,ed.checkoutVerify({orderId:It.razorpay_order_id,paymentId:It.razorpay_payment_id,signature:It.razorpay_signature}).then(()=>Le()).catch(Bt=>Qe(Bt instanceof Error?Bt:new Error("Verification failed")))},modal:{ondismiss:()=>{mt||Qe(new Error(K9))}},theme:{color:"#0B4DD1"},prefill:e!=null&&e.email?{email:e.email}:void 0});ft.on("payment.failed",It=>{var Bt;Qe(new Error(((Bt=It.error)==null?void 0:Bt.description)||"Payment failed"))}),ft.open()}),await Ft()}catch(Re){const ze=Re instanceof Error?Re.message:"Payment failed";ze!==K9&&window.alert(ze)}finally{Pt(!1)}}},Be=async Re=>{var ze;if(!(!Re||!t||!r))try{const Qe=(ze=(await Sa(Re,{eventId:t,module:"ticketing-upi-qr"})).url)==null?void 0:ze.trim();Qe&&Me(Qe)}catch(Le){window.alert(Le instanceof Error?Le.message:"Upload failed")}},ct=()=>{var Re;b(null),j(""),T(""),P([""]),O(""),I("INR"),F(0),Y(""),$(((Re=u[0])==null?void 0:Re._id)||""),V(""),z([]),v(!0)},Tt=Re=>{var ze,Le;b(Re),j(Re.name),T(Re.description||""),P((ze=Re.keyPoints)!=null&&ze.length?Re.keyPoints:[""]),O(String((Re.basePriceMinor||0)/100)),I(Re.currency||"INR"),F(Re.sortOrder??0),Y(Re.maxPerOrder!=null?String(Re.maxPerOrder):""),$(Re.participantList),V(Re.registrationForm||""),z((Le=Re.taxItems)!=null&&Le.length?[...Re.taxItems]:[]),v(!0)},We=async()=>{if(!t||!X)return;const Re=parseFloat(N);if(!Number.isFinite(Re)||Re<0){window.alert("Enter a valid price.");return}const ze=Math.round(Re*100),Le={name:k.trim(),description:_.trim(),keyPoints:A.map(Qe=>Qe.trim()).filter(Boolean),basePriceMinor:ze,currency:C,sortOrder:R,maxPerOrder:M.trim()?parseInt(M,10):null,taxItems:D,participantList:X,registrationForm:ee.trim()||null,isActive:!0};w(!0);try{m?await Ky.update(t,m._id,Le):await Ky.create(t,Le),v(!1),await vt()}catch(Qe){window.alert(Qe instanceof Error?Qe.message:"Save failed")}finally{w(!1)}},ce=async Re=>{if(t&&window.confirm(`Deactivate “${Re.name}”? It will no longer appear on the public checkout page.`))try{await Ky.remove(t,Re._id),await vt()}catch(ze){window.alert(ze instanceof Error?ze.message:"Failed")}},he=()=>{Et&&navigator.clipboard.writeText(Et).then(()=>window.alert("Checkout link copied."),()=>window.alert(Et))};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:Xo,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:he,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(Js,{size:14})," Copy checkout link"]}),i.jsxs("a",{href:Et||"#",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(bv,{size:14})," Open checkout"]}),i.jsxs("button",{type:"button",onClick:ct,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(gr,{size:14})," Add ticket"]})]}),Et&&i.jsx("code",{style:{fontSize:"11px",color:"var(--muted)",maxWidth:"420px",wordBreak:"break-all",textAlign:"right"},children:Et})]})]}),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(Re=>{var ze;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:Re.isActive?1:.65},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-inter)",marginBottom:"4px"},children:[Re.name," ",!Re.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:[e8e(Re.basePriceMinor,Re.currency),(ze=Re.taxItems)!=null&&ze.length?` · ${Re.taxItems.length} tax row(s)`:""]}),Re.description&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",maxWidth:"640px"},children:Re.description})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[i.jsxs("button",{type:"button",onClick:()=>Tt(Re),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(wi,{size:14})," Edit"]}),Re.isActive&&i.jsxs("button",{type:"button",onClick:()=>void ce(Re),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(Xr,{size:14})," Deactivate"]})]})]},Re._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."}),K&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)"},children:K}),U&&i.jsx("p",{style:{color:"var(--muted)"},children:"Loading UPI settings…"}),!U&&q&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[q.enablementPaid?i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:["Enablement fee paid",q.enablementPaidAt?` · ${new Date(q.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 ",((xe=(je=q.enablementFeeInr)==null?void 0:je.toFixed)==null?void 0:xe.call(je,0))??q.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."]}),qe?i.jsx("button",{type:"button",disabled:et,onClick:()=>void Xe(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:et?"wait":"pointer",fontSize:"var(--text-sm)"},children:et?"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:de,disabled:!q.enablementPaid&&!de,onChange:Re=>le(Re.target.checked)}),"Enable UPI / manual checkout for this event"]}),!q.enablementPaid&&!de?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Complete payment above before you can enable this option."}):null,de&&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:Xo,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:se==="upload",onChange:()=>be("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:se==="dynamic",onChange:()=>be("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."]})]})]}),se==="upload"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"UPI QR image"}),i.jsx("input",{type:"file",accept:"image/*",onChange:Re=>{var ze;return void Be(((ze=Re.target.files)==null?void 0:ze[0])??null)}}),ue?i.jsx("img",{src:ue,alt:"QR",style:{maxWidth:200,borderRadius:8,border:"1px solid var(--border)"}}):null,i.jsx("input",{value:ue,onChange:Re=>Me(Re.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:Xo,children:"UPI ID (optional, shown to buyers)"}),i.jsx("input",{value:Se,onChange:Re=>Pe(Re.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:Xo,children:"Payee name (optional)"}),i.jsx("input",{value:Ee,onChange:Re=>Ae(Re.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:Xo,children:"UPI ID (VPA) — required"}),i.jsx("input",{value:Se,onChange:Re=>Pe(Re.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)."}),De?i.jsx("img",{src:De,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:Xo,children:"Instructions for buyers"}),i.jsx("textarea",{value:Ye,onChange:Re=>rt(Re.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:H,onClick:()=>void lt(),style:{alignSelf:"flex-start",padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer"},children:H?"Saving…":"Save UPI settings"})]})]}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",marginTop:"24px",marginBottom:"8px"},children:"Pending UPI proofs"}),st?i.jsx("p",{style:{color:"var(--muted)"},children:"Refreshing…"}):He.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:He.map(Re=>{var ze;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:[((ze=Re.ticket)==null?void 0:ze.name)||"Ticket"," · ",Re.purchaserEmail]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:[Re.quote&&typeof Re.quote.totalMinor=="number"?`${Re.quote.totalMinor/100} ${Re.currency}`:"—"," ","· ",Re.createdAt?new Date(Re.createdAt).toLocaleString():""]}),Re.buyerNote?i.jsx("p",{style:{fontSize:"var(--text-sm)",margin:"8px 0 0"},children:Re.buyerNote}):null,Re.screenshotUrl?i.jsx("a",{href:Re.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 z0.approve(t,Re._id),await Ce(),await vt()}catch(Le){window.alert(Le instanceof Error?Le.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 Le=window.prompt("Reject reason (optional)")??"";try{await z0.reject(t,Re._id,Le),await Ce()}catch(Qe){window.alert(Qe instanceof Error?Qe.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"})]})]},Re._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:()=>!x&&v(!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:Re=>Re.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:Xo,children:"Name"}),i.jsx("input",{value:k,onChange:Re=>j(Re.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:Xo,children:"Description"}),i.jsx("textarea",{value:_,onChange:Re=>T(Re.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:Xo,children:"Key points"}),A.map((Re,ze)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"6px"},children:[i.jsx("input",{value:Re,onChange:Le=>{const Qe=[...A];Qe[ze]=Le.target.value,P(Qe)},placeholder:"Bullet point",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>P(A.filter((Le,Qe)=>Qe!==ze)),style:{padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"8px",background:"var(--background)"},children:"−"})]},ze)),i.jsx("button",{type:"button",onClick:()=>P([...A,""]),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:Xo,children:["Price (",C,")"]}),i.jsx("input",{value:N,onChange:Re=>O(Re.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:Xo,children:"Currency"}),i.jsx("input",{value:C,onChange:Re=>I(Re.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:Xo,children:"Sort order"}),i.jsx("input",{type:"number",value:R,onChange:Re=>F(parseInt(Re.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:Xo,children:"Max per order (optional)"}),i.jsx("input",{value:M,onChange:Re=>Y(Re.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:Xo,children:"Participant list (fixed)"}),i.jsxs("select",{value:X,onChange:Re=>$(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"Select list…"}),u.map(Re=>i.jsx("option",{value:Re._id,children:Re.name},Re._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Registration form (optional)"}),i.jsxs("select",{value:ee,onChange:Re=>V(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"None"}),f.map(Re=>i.jsxs("option",{value:Re._id,children:[Re.name," (",Re.type,")"]},Re._id))]})]}),i.jsxs("div",{children:[i.jsx("span",{style:Xo,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)."}),D.map((Re,ze)=>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:Re.label,onChange:Le=>{const Qe=[...D];Qe[ze]={...Qe[ze],label:Le.target.value},z(Qe)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{type:"number",placeholder:"%",value:Re.rateBps/100,onChange:Le=>{const Qe=parseFloat(Le.target.value)||0,mt=[...D];mt[ze]={...mt[ze],rateBps:Math.round(Qe*100)},z(mt)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{placeholder:"States or empty = all",value:Re.appliesToStates.join(","),onChange:Le=>{const Qe=[...D];Qe[ze]={...Qe[ze],appliesToStates:Le.target.value.split(",").map(mt=>mt.trim().toUpperCase()).filter(Boolean)},z(Qe)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>z(D.filter((Le,Qe)=>Qe!==ze)),style:{padding:"8px",border:"1px solid var(--border)",borderRadius:"8px"},children:"×"})]},ze)),i.jsx("button",{type:"button",onClick:()=>z([...D,{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:x,onClick:()=>v(!1),style:{padding:"8px 16px",borderRadius:"8px",border:"1px solid var(--border)",background:"var(--background)"},children:"Cancel"}),i.jsx("button",{type:"button",disabled:x||!k.trim()||!X,onClick:()=>void We(),style:{padding:"8px 16px",borderRadius:"8px",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",opacity:x?.7:1},children:x?"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 r8e({...e}){return i.jsx(iU,{"data-slot":"sheet",...e})}function n8e({...e}){return i.jsx(oU,{"data-slot":"sheet-portal",...e})}const BX=S.forwardRef(({className:e,...t},r)=>i.jsx(aU,{ref:r,"data-slot":"sheet-overlay",className:ea("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}));BX.displayName="SheetOverlay";function i8e({className:e,children:t,side:r="right",...n}){return i.jsxs(n8e,{children:[i.jsx(BX,{}),i.jsxs(sU,{"data-slot":"sheet-content",className:ea("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(cU,{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(Gt,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function o8e({className:e,...t}){return i.jsx("div",{"data-slot":"sheet-header",className:ea("flex flex-col gap-1.5 p-4",e),...t})}function a8e({className:e,...t}){return i.jsx(lU,{"data-slot":"sheet-title",className:ea("text-foreground font-semibold",e),...t})}function s8e(e){const t=S.useRef({value:e,previous:e});return S.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var lI="Switch",[l8e]=uS(lI),[c8e,u8e]=l8e(lI),WX=S.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]=S.useState(null),v=zl(t,k=>p(k)),m=S.useRef(!1),b=h?d||!!h.closest("form"):!0,[x=!1,w]=xT({prop:o,defaultProp:a,onChange:u});return i.jsxs(c8e,{scope:r,checked:x,disabled:l,children:[i.jsx(_a.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":UX(x),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:v,onClick:hs(e.onClick,k=>{w(j=>!j),b&&(m.current=k.isPropagationStopped(),m.current||k.stopPropagation())})}),b&&i.jsx(d8e,{control:h,bubbles:!m.current,name:n,value:c,checked:x,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});WX.displayName=lI;var qX="SwitchThumb",$X=S.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,o=u8e(qX,r);return i.jsx(_a.span,{"data-state":UX(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:t})});$X.displayName=qX;var d8e=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=S.useRef(null),s=s8e(r),l=CK(t);return S.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 UX(e){return e?"checked":"unchecked"}var f8e=WX,p8e=$X;function h8e({className:e,...t}){return i.jsx(f8e,{"data-slot":"switch",className:ea("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(p8e,{"data-slot":"switch-thumb",className:ea("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 g8e="https://api.eventbuzz.live/api".replace(/\/api\/?$/,"")||(typeof window<"u"?window.location.origin:"");function qy(e){return e?e.startsWith("http")?e:`${g8e}${e.startsWith("/")?"":"/"}${e}`:""}const m8e=3;function v8e({eventId:e,open:t,onOpenChange:r}){const[n,o]=S.useState({}),[a,s]=S.useState(!1),[l,c]=S.useState(null),[u,d]=S.useState("idle"),[f,h]=S.useState(null),[p,v]=S.useState([]),[m,b]=S.useState(!1),x=S.useRef(null),w=wc(m8e),k=S.useCallback(async()=>{if(e){s(!0);try{const O=await Xc.get(e);o(O.data||{})}catch{o({})}finally{s(!1)}}},[e]);S.useEffect(()=>{t&&e&&(k(),b(!0),Vs.list({type:"microsite",limit:50}).then(O=>{var C;v(((C=O.data)==null?void 0:C.templates)??[])}).catch(()=>v([])).finally(()=>b(!1)))},[t,e,k]);const j=S.useCallback(async O=>{if(e){h(null),c(O);try{await Xc.update(e,n),w.advance(O)}catch(C){h(C instanceof Error?C.message:"Failed to save")}finally{c(null)}}},[e,n,w]),_=S.useCallback(async()=>{var C;const O=(n.folder||"").trim().toLowerCase().replace(/[^a-z0-9-]/g,"");if(!O){d("idle");return}if(e){d("checking");try{const I=await Xc.checkFolder(e,O);d((C=I.data)!=null&&C.available?"available":"taken")}catch{d("idle")}}},[e,n.folder]);S.useEffect(()=>{if(x.current&&clearTimeout(x.current),!(n.folder||"").trim()){d("idle");return}return x.current=setTimeout(()=>_(),500),()=>{x.current&&clearTimeout(x.current)}},[n.folder,_]);const T=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/logo"});o(F=>({...F,logo:R.url}))}catch{}O.target.value=""}},A=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/banner"});o(F=>({...F,banners:[...F.banners||[],R.url]}))}catch{}O.target.value=""}},P=O=>{o(C=>({...C,banners:(C.banners||[]).filter((I,R)=>R!==O)}))},N=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/favicon"});o(F=>({...F,favicon:R.url}))}catch{}O.target.value=""}};return i.jsx(r8e,{open:t,onOpenChange:r,children:i.jsxs(i8e,{side:"right",className:"sm:max-w-2xl flex flex-col p-0",children:[i.jsx(o8e,{className:"px-4 pt-4 pb-2 border-b border-border",children:i.jsxs(a8e,{className:"flex items-center gap-2",children:[i.jsx(hc,{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(kx,{className:"size-6 animate-spin text-muted-foreground"})}):i.jsxs(i.Fragment,{children:[i.jsxs(Ur,{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:()=>j(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(h8e,{checked:!!n.enabled,onCheckedChange:O=>o(C=>({...C,enabled:O}))}),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:O=>o(C=>({...C,folder:O.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:O=>o(C=>({...C,title:O.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:O=>o(C=>({...C,description:O.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:O=>o(C=>({...C,keywords:O.target.value.split(",").map(I=>I.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(Ur,{n:2,title:"Template",subtitle:"Choose a microsite template",open:w.open===2,completed:w.done.has(2),onToggle:()=>w.toggle(2),onSave:()=>j(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(kx,{className:"size-5 animate-spin text-muted-foreground"})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:p.map(O=>i.jsxs("div",{style:{background:"var(--card)",border:n.templateId===O._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:O.thumbnail?i.jsx("img",{src:qy(O.thumbnail),alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):i.jsx(w$,{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:O.name}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>o(C=>({...C,templateId:O._id})),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:n.templateId===O._id?"var(--primary)":"var(--secondary)",color:n.templateId===O._id?"var(--primary-foreground)":"var(--foreground)",cursor:"pointer",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"500"},children:[n.templateId===O._id?i.jsx(bi,{size:10}):null," Select"]}),i.jsxs("button",{type:"button",onClick:()=>O.thumbnail?window.open(qy(O.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(qh,{size:10})," Preview"]})]})]})]},O._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(Ur,{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:()=>j(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:qy(n.logo),alt:"Logo",style:{height:40,objectFit:"contain",border:"1px solid var(--border)",borderRadius:4}}),i.jsx("button",{type:"button",onClick:()=>o(O=>({...O,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:T,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:qy(n.favicon),alt:"Favicon",style:{width:24,height:24,objectFit:"contain"}}),i.jsx("button",{type:"button",onClick:()=>o(O=>({...O,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:N,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((O,C)=>i.jsxs("div",{style:{position:"relative"},children:[i.jsx("img",{src:qy(O),alt:"",style:{height:64,width:96,objectFit:"cover",borderRadius:4,border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>P(C),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:"×"})]},C))}),i.jsx("input",{type:"file",accept:"image/*",onChange:A,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]})]})]})})]})})}function y8e(e){return e.replace(/\/+$/,"")}function x8e(){return y8e("https://builder.eventbuzz.live")}function HX(){try{return new URL(x8e()).origin}catch{return"*"}}const b8e="EB_EXPORT_HTML",w8e="EB_EXPORT_HTML_RESULT";function qw(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=HX(),l=u=>{var d;u.source===o&&(((d=u.data)==null?void 0:d.type)!==w8e||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:b8e,requestId:a},s==="*"?"*":s)})}function VX(e){return e.replace(/\/+$/,"")}function S8e(){return VX("https://builder.eventbuzz.live")}function j8e(){return VX("https://api.eventbuzz.live/api")}function k8e(...e){return t=>{e.forEach(r=>{r&&(typeof r=="function"?r(t):r.current=t)})}}const _8e="EB_BUILDER_READY",YX=S.forwardRef(function({pageId:t,eventId:r,micrositeId:n=null,variant:o="default",mountNonce:a=0},s){const l=S.useRef(null),c=HX(),u=S.useCallback(()=>{var w;const v=(w=l.current)==null?void 0:w.contentWindow;if(!v)return;const m=Vee(),b=j8e(),x={type:"SET_AUTH_TOKEN",token:m,pageId:t,eventId:r,apiBaseUrl:b};n&&String(n).trim()&&(x.micrositeId=String(n).trim()),v.postMessage(x,c==="*"?"*":c)},[t,r,n,c]),d=S.useCallback(()=>{u(),window.setTimeout(u,0),window.setTimeout(u,50),window.setTimeout(u,200)},[u]);S.useEffect(()=>{const v=m=>{var b,x;m.source===((b=l.current)==null?void 0:b.contentWindow)&&((x=m.data)==null?void 0:x.type)===_8e&&d()};return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[d]);const f=S.useCallback(()=>{d()},[d]),h=S8e(),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:k8e(l,s),src:h,onLoad:f,title:"Microsite visual editor",style:{width:"100%",flex:1,minHeight:0,border:"none"}},`${t}-${a}-${n??"legacy"}`)})}),Q9={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 X9(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 C8e(){var vt,Ft;const{selectedEventId:e,pendingMicrositeBuilder:t,setPendingMicrositeBuilder:r}=Li(),[n,o]=S.useState([]),[a,s]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(""),[f,h]=S.useState("home"),[p,v]=S.useState(""),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(null),[_,T]=S.useState(!1),[A,P]=S.useState(!1),[N,O]=S.useState(!1),C=S.useRef(null),[I,R]=S.useState(null),[F,M]=S.useState({}),[Y,X]=S.useState(""),[$,ee]=S.useState(!1),[V,D]=S.useState(!1),[z,q]=S.useState(null),[G,U]=S.useState(""),[Q,K]=S.useState(!1),[re,H]=S.useState("sections"),[ie,de]=S.useState(""),[le,ke]=S.useState(null),ve=S.useRef(null),[se,be]=S.useState(!1),[De,ae]=S.useState(null),ue=S.useCallback(async()=>{var Ce;if(e){s(!0);try{const lt=await Yc.list(e);o(((Ce=lt.data)==null?void 0:Ce.pages)??[])}catch{o([])}finally{s(!1)}}},[e]);S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{if(!e){de(""),ke(null);return}(async()=>{var Be;const Ce=await ha.list(e);if(Ce.data&&Ce.data.length>0){const ct=Ce.data[0];ke(ct._id),de(ct.publishFolder!=null?String(ct.publishFolder).trim():"");return}ke(null);const lt=await Xc.get(e),Xe=((Be=lt.data)==null?void 0:Be.folder)!=null?String(lt.data.folder).trim():"";de(Xe)})().catch(()=>{ke(null),de("")})},[e]),S.useEffect(()=>{const Ce=t;!Ce||!e||Ce.eventId!==e||(r(null),(async()=>{var Xe;let lt=Ce.pageId;if(!lt)try{const ct=((Xe=(await Yc.list(e)).data)==null?void 0:Xe.pages)??[],Tt=ct.find(We=>We.type==="home")??ct[0];lt=(Tt==null?void 0:Tt._id)??null}catch{lt=null}lt&&(w(lt),H(Ce.mode))})())},[t,e,r]);const Me=S.useCallback(async()=>{if(ae(null),!e||!ie.trim()){ae("Set a microsite URL slug in Configure event microsite first.");return}be(!0);try{const Ce=await qw(ve.current);if(le){const lt=await ha.update(e,le,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await ha.publish(e,le,{targets:"draft"});if(Xe.error)throw new Error(Xe.error)}else{const lt=await Xc.update(e,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await Xc.publishMicrosite(e,{targets:"draft"});if(Xe.error)throw new Error(Xe.error)}}catch(Ce){ae(Ce instanceof Error?Ce.message:"Save failed")}finally{be(!1)}},[e,ie,le]),Se=S.useCallback(async()=>{if(ae(null),!e||!ie.trim()){ae("Set a microsite URL slug in Configure event microsite first.");return}be(!0);try{const Ce=await qw(ve.current);if(le){const lt=await ha.update(e,le,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await ha.publish(e,le,{targets:"both"});if(Xe.error)throw new Error(Xe.error)}else{const lt=await Xc.update(e,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await Xc.publishMicrosite(e,{targets:"both"});if(Xe.error)throw new Error(Xe.error)}}catch(Ce){ae(Ce instanceof Error?Ce.message:"Publish failed")}finally{be(!1)}},[e,ie,le]),Pe=S.useCallback(async Ce=>{T(!0);try{const lt=await Yc.get(Ce);j(lt.data??null)}catch{j(null)}finally{T(!1)}},[]);S.useEffect(()=>{x?Pe(x):j(null)},[x,Pe]),S.useEffect(()=>{const Ce=lt=>{C.current&&!C.current.contains(lt.target)&&P(!1)};return document.addEventListener("mousedown",Ce),()=>document.removeEventListener("mousedown",Ce)},[]);const Ee=async Ce=>{if(!x)return;const lt=await Yc.update(x,{sections:Ce});lt.data&&j(lt.data)},Ae=(Ce,lt)=>{if(!(k!=null&&k.sections))return;const Be=[...[...k.sections].sort((We,ce)=>(We.order??0)-(ce.order??0))],ct=lt==="up"?Ce-1:Ce+1;if(ct<0||ct>=Be.length)return;[Be[Ce],Be[ct]]=[Be[ct],Be[Ce]];const Tt=Be.map((We,ce)=>({...We,order:ce}));Ee(Tt)},Ye=Ce=>{if(!(k!=null&&k.sections))return;const Xe=[...k.sections].sort((Be,ct)=>(Be.order??0)-(ct.order??0)).filter((Be,ct)=>ct!==Ce).map((Be,ct)=>({...Be,order:ct}));Ee(Xe)},rt=async Ce=>{if(!x||!k)return;P(!1),O(!0);const lt=k.sections??[],Xe=lt.length,Be={id:crypto.randomUUID(),type:Ce,order:Xe,config:X9(Ce)},ct=[...lt,Be];try{const Tt=await Yc.update(x,{sections:ct});Tt.data&&j(Tt.data)}finally{O(!1)}},He=Ce=>{R(Ce.id),X(Ce.type),M({...Ce.config||X9(Ce.type)})},xt=async()=>{if(!x||!k||!I)return;ee(!0);const Ce=(k.sections??[]).map(lt=>lt.id===I?{...lt,config:{...F}}:lt);try{const lt=await Yc.update(x,{sections:Ce});lt.data&&(j(lt.data),R(null))}finally{ee(!1)}},st=(Ce,lt)=>{M(Xe=>({...Xe,[Ce]:lt}))},Te=(Ce,lt,Xe,Be)=>{M(ct=>{const We=[...ct[Ce]??[]];return We[lt]?(We[lt]={...We[lt],[Xe]:Be},{...ct,[Ce]:We}):ct})},et=(Ce,lt)=>{M(Xe=>{const Be=Xe[Ce]??[];return{...Xe,[Ce]:[...Be,lt]}})},Pt=(Ce,lt)=>{M(Xe=>{const Be=Xe[Ce]??[];return{...Xe,[Ce]:Be.filter((ct,Tt)=>Tt!==lt)}})},qe=async Ce=>{var lt;if(x){q(null),D(!0);try{const Xe=await Yc.exportHtml(x,G.trim()||void 0);if(Xe.error){q(Xe.error);return}const Be=(lt=Xe.data)==null?void 0:lt.html;if(!Be){q("No HTML returned");return}if(Ce){const ct=window.open("","_blank");ct?(ct.document.write(Be),ct.document.close()):q("Popup blocked. Allow popups to preview.")}else{const ct=new Blob([Be],{type:"text/html"}),Tt=URL.createObjectURL(ct),We=document.createElement("a");We.href=Tt,We.download=((k==null?void 0:k.slug)||"page")+".html",We.click(),URL.revokeObjectURL(Tt)}}catch(Xe){q(Xe instanceof Error?Xe.message:"Export failed")}finally{D(!1)}}},Et=async Ce=>{if(Ce.preventDefault(),!(!e||!u.trim())){b(!0);try{(await Yc.create(e,{title:u.trim(),type:f,slug:p.trim()||void 0})).data&&(c(!1),d(""),h("home"),v(""),ue())}finally{b(!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"})]}),x?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),j(null),q(null),H("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(uT,{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)??((vt=n.find(Ce=>Ce._id===x))==null?void 0:vt.title)??"Page"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>H("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(T3,{size:16})," Visual builder"]}),i.jsxs("button",{type:"button",onClick:()=>K(!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(hc,{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:()=>H("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:()=>H("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 ",le?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:[ie||"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&&x?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:se||!ie.trim(),onClick:()=>void Me(),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:se||!ie.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(sS,{size:16,"aria-hidden":!0})," ",se?"Working…":"Save (draft site)"]}),i.jsxs("button",{type:"button",disabled:se||!ie.trim(),onClick:()=>void Se(),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:se||!ie.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(j$,{size:16,"aria-hidden":!0})," Publish"]})]}),De?i.jsx("p",{style:{margin:"8px 0 0",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:De}):null,i.jsx(YX,{ref:ve,pageId:x,eventId:e,micrositeId:le??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:G,onChange:Ce=>U(Ce.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:()=>qe(!0),disabled:V,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:V?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(bv,{size:14})," ",V?"Loading…":"Preview HTML"]}),i.jsxs("button",{type:"button",onClick:()=>qe(!1),disabled:V,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:V?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ja,{size:14})," Download HTML"]})]}),z&&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:z}),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:C,style:{position:"relative"},children:[i.jsxs("button",{type:"button",disabled:N,onClick:()=>P(Ce=>!Ce),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:N?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Add section"]}),A&&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:Kee.map(Ce=>i.jsx("button",{type:"button",onClick:()=>rt(Ce),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:Q9[Ce]??Ce},Ce))})]})]}),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…"}):(Ft=k.sections)!=null&&Ft.length?i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:[...k.sections??[]].sort((Ce,lt)=>(Ce.order??0)-(lt.order??0)).map((Ce,lt)=>{var Xe,Be,ct;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:Ce.type.replace(/_/g," ")}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Order: ",lt+1]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginLeft:"auto"},children:[i.jsx("button",{type:"button",onClick:()=>He(Ce),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(wi,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ae(lt,"up"),disabled:lt===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:lt===0?"not-allowed":"pointer",opacity:lt===0?.5:1},children:i.jsx(Qf,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ae(lt,"down"),disabled:lt===(((Xe=k.sections)==null?void 0:Xe.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:lt===(((Be=k.sections)==null?void 0:Be.length)??0)-1?"not-allowed":"pointer",opacity:lt===(((ct=k.sections)==null?void 0:ct.length)??0)-1?.5:1},children:i.jsx(go,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ye(lt),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(Xr,{size:14})})]})]},Ce.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:()=>K(!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(hc,{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(gr,{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(""),v("")},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--muted)"},children:i.jsx(Gt,{size:18})})]}),i.jsxs("form",{onSubmit:Et,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:Ce=>d(Ce.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:Ce=>h(Ce.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:Gee.map(Ce=>i.jsx("option",{value:Ce,children:Ce},Ce))})]}),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:Ce=>v(Ce.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(""),v("")},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(aN,{icon:i.jsx(Wf,{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(Ce=>{var lt;return i.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{w(Ce._id),H("sections")},onKeyDown:Xe=>{(Xe.key==="Enter"||Xe.key===" ")&&(Xe.preventDefault(),w(Ce._id),H("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:Ce.title}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:Ce.slug}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",textTransform:"capitalize"},children:Ce.type}),((lt=Ce.settings)==null?void 0:lt.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:Xe=>{Xe.stopPropagation(),w(Ce._id),H("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(T3,{size:14})," Visual builder"]})]},Ce._id)})]})})]}),i.jsx(v8e,{eventId:e,open:Q,onOpenChange:K}),i.jsx(Foe,{open:!!I,onOpenChange:Ce=>{Ce||R(null)},title:`Edit section: ${Q9[Y]??Y}`,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"70vh",overflowY:"auto"},children:[Y==="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(F.logoText??""),onChange:Ce=>st("logoText",Ce.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)"}),(F.menuItems??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Ce==null?void 0:Ce.label)??"",onChange:Xe=>Te("menuItems",lt,"label",Xe.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:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("menuItems",lt,"url",Xe.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:()=>Pt("menuItems",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("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"})]})]}),Y==="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(F.headline??""),onChange:Ce=>st("headline",Ce.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(F.subtext??""),onChange:Ce=>st("subtext",Ce.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(F.ctaText??""),onChange:Ce=>st("ctaText",Ce.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(F.ctaUrl??""),onChange:Ce=>st("ctaUrl",Ce.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(F.secondaryCtaText??""),onChange:Ce=>st("secondaryCtaText",Ce.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(F.secondaryCtaUrl??""),onChange:Ce=>st("secondaryCtaUrl",Ce.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(F.backgroundClass??""),onChange:Ce=>st("backgroundClass",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.submitLabel??""),onChange:Ce=>st("submitLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.primaryLabel??""),onChange:Ce=>st("primaryLabel",Ce.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(F.primaryUrl??""),onChange:Ce=>st("primaryUrl",Ce.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(F.secondaryLabel??""),onChange:Ce=>st("secondaryLabel",Ce.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(F.secondaryUrl??""),onChange:Ce=>st("secondaryUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.limit??12),onChange:Ce=>st("limit",Ce.target.value===""?12:parseInt(Ce.target.value,10)||12),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.copyrightText??""),onChange:Ce=>st("copyrightText",Ce.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)"}),(F.links??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Ce==null?void 0:Ce.label)??"",onChange:Xe=>Te("links",lt,"label",Xe.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:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("links",lt,"url",Xe.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:()=>Pt("links",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("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"})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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)"}),(F.sponsors??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Name",value:(Ce==null?void 0:Ce.name)??"",onChange:Xe=>Te("sponsors",lt,"name",Xe.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:(Ce==null?void 0:Ce.logoUrl)??"",onChange:Xe=>Te("sponsors",lt,"logoUrl",Xe.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:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("sponsors",lt,"url",Xe.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:()=>Pt("sponsors",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("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"})]})]}),Y==="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(F.headline??""),onChange:Ce=>st("headline",Ce.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(F.subtext??""),onChange:Ce=>st("subtext",Ce.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(F.buttonLabel??""),onChange:Ce=>st("buttonLabel",Ce.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(F.buttonUrl??""),onChange:Ce=>st("buttonUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.html??""),onChange:Ce=>st("html",Ce.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"}})]}),Y==="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(F.headingLine??""),onChange:Ce=>st("headingLine",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.lead??""),onChange:Ce=>st("lead",Ce.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(F.bulletsTitle??""),onChange:Ce=>st("bulletsTitle",Ce.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(F.ctaLabel??""),onChange:Ce=>st("ctaLabel",Ce.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(F.ctaUrl??""),onChange:Ce=>st("ctaUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.venueName??""),onChange:Ce=>st("venueName",Ce.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(F.intro??""),onChange:Ce=>st("intro",Ce.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(F.mapEmbedUrl??""),onChange:Ce=>st("mapEmbedUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.contactEmail??""),onChange:Ce=>st("contactEmail",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="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(F.title??""),onChange:Ce=>st("title",Ce.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(F.intro??""),onChange:Ce=>st("intro",Ce.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:xt,disabled:$,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:$?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:$?"Saving…":"Save"}),i.jsx("button",{type:"button",onClick:()=>R(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(aN,{icon:i.jsx(Wf,{size:24}),title:"Select an event",description:"Choose an event from the sidebar to build and manage its website pages."})})]})}const rc={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"},Z9={...rc,cursor:"pointer",appearance:"none",paddingRight:"32px"},Cl=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.12)"},El=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 $y({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 Zo({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 LE({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function J9({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Uy({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 E8e=2*1024*1024,GX="image/jpeg,image/png,image/webp,image/gif";function A8e(e){return e.type&&GX.split(",").includes(e.type)?!0:/\.(jpe?g|png|webp|gif)$/i.test(e.name)}function T8e({preview:e,onChange:t,eventId:r}){const n=S.useRef(null),[o,a]=S.useState(!1),[s,l]=S.useState(null),c=async d=>{if(l(null),!A8e(d)){l("Use a JPG, PNG, WEBP, or GIF image.");return}if(d.size>E8e){l("Image must be 2 MB or smaller.");return}a(!0);try{const f=await Sa(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:GX,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(Fl,{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 FE({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:{...rc,flex:1,width:"auto"},placeholder:t,value:r,onChange:o=>n(o.target.value),onFocus:Cl,onBlur:El})]})}function P8e({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(bi,{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 zE({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(P8e,{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(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{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(bi,{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 I8e={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 O8e(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 Hy=["fullName","title","specialisation","organisation","email","role"];function eW(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 tW(e){const t={};return e.bio.trim()||(t.bio="Bio is required."),t}function Vy(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function N8e({onClose:e,speakerId:t,onSuccess:r,eventId:n}){const{user:o}=Mr(),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]=S.useState(1),[u,d]=S.useState(new Set),[f,h]=S.useState(I8e),[p,v]=S.useState(!1),[m,b]=S.useState({}),[x,w]=S.useState(!1),[k,j]=S.useState(!1);S.useEffect(()=>{t&&Lf.get(t).then(M=>{var Y,X,$,ee,V;if(M.data){const D=M.data,z=D.logistics;h({fullName:`${D.firstName} ${D.lastName}`.trim(),title:D.title??"",specialisation:((Y=D.expertise)==null?void 0:Y[0])??"",organisation:D.organizationName??"",email:D.email,phone:D.phone??"",photo:D.photo??null,bio:D.bio??"",website:((X=D.socialLinks)==null?void 0:X.website)??"",linkedin:(($=D.socialLinks)==null?void 0:$.linkedin)??"",twitter:((ee=D.socialLinks)==null?void 0:ee.twitter)??"",role:((V=D.speakerRole)==null?void 0:V.trim())||"Speaker",visibility:D.profileVisibility==="private"?"Private":"Public",featured:D.isFeatured?"Yes":"No",honorarium:z!=null&&z.honorarium?"Yes":"No",honorariumAmount:(z==null?void 0:z.honorariumAmount)!=null?String(z.honorariumAmount):"",travelRequired:z!=null&&z.travelRequired?"Yes":"No",accommodation:z!=null&&z.accommodation?"Yes":"No",dietaryRequirements:(z==null?void 0:z.dietaryRequirements)??"",notes:(z==null?void 0:z.internalNotes)??""}),d(new Set([1,2,3]))}})},[t]),S.useEffect(()=>{if(!x)return;const M=eW(f);Object.keys(M).length===0?b(Y=>Vy(Y,Hy)):b(Y=>({...Vy(Y,Hy),...M}))},[f.fullName,f.email,f.title,f.specialisation,f.organisation,f.role,x]),S.useEffect(()=>{if(!k)return;const M=tW(f);Object.keys(M).length===0?b(Y=>{const X={...Y};return delete X.bio,X}):b(Y=>({...Y,bio:M.bio}))},[f.bio,k]);const _=3,T=u.size,A=Math.round(T/_*100),P=(M,Y)=>h(X=>({...X,[M]:Y})),N=M=>{d(Y=>new Set([...Y,M])),M===1&&b(Y=>Vy(Y,Hy)),M===2&&b(Y=>{const X={...Y};return delete X.bio,X}),M<_&&c(M+1)},O=M=>{if(M===1){const Y=eW(f);if(Object.keys(Y).length){w(!0),b($=>({...Vy($,Hy),...Y}));return}w(!1),b($=>Vy($,Hy)),N(1);return}if(M===2){const Y=tW(f);if(Object.keys(Y).length){j(!0),b(X=>({...X,...Y}));return}j(!1),b(X=>{const $={...X};return delete $.bio,$}),N(2)}},C=()=>{b(M=>{const Y={...M};return delete Y._submit,Y}),N(3),F()},I=M=>c(Y=>Y===M?0:M),R=!p&&!!f.fullName.trim()&&!!f.email.trim(),F=async()=>{const{firstName:M,lastName:Y}=O8e(f.fullName);if(!M.trim()||!f.email.trim())return;v(!0);const X={firstName:M,lastName:Y,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&&(X.organization=a);const $=s&&t?await Lf.update(t,X):await Lf.create(X);v(!1),$.error?(b(ee=>({...ee,_submit:$.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: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(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:!R,onClick:F,style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:R?"var(--primary)":"var(--secondary)",color:R?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:R?"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:[T," 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:[A,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${A}%`,background:A===100?"#22c55e":"var(--primary)",borderRadius:"99px",transition:"width 0.35s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsx(zE,{n:1,title:"Personal Information",subtitle:"Name, contact, role on programme, and profile visibility",open:l===1,completed:u.has(1),onToggle:()=>I(1),onSave:()=>O(1),nextLabel:"Profile & Media",children:i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{error:m.fullName,children:[i.jsx(Po,{text:"Full Name",required:!0}),i.jsx("input",{style:{...rc,...m.fullName?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dr. Rajesh Sharma",value:f.fullName,onChange:M=>P("fullName",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.title,children:[i.jsx(Po,{text:"Title / Designation",required:!0}),i.jsx(J9,{children:i.jsxs("select",{style:{...Z9,...m.title?{borderColor:"var(--destructive)"}:{}},value:f.title,onChange:M=>P("title",M.target.value),onFocus:Cl,onBlur:El,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(Zo,{error:m.specialisation,children:[i.jsx(Po,{text:"Specialisation",required:!0}),i.jsx("input",{style:{...rc,...m.specialisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Pulmonologist",value:f.specialisation,onChange:M=>P("specialisation",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.organisation,children:[i.jsx(Po,{text:"Organisation / Institution",required:!0}),i.jsx("input",{style:{...rc,...m.organisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. AIIMS Delhi",value:f.organisation,onChange:M=>P("organisation",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.email,children:[i.jsx(Po,{text:"Email Address",required:!0}),i.jsx("input",{type:"email",style:{...rc,...m.email?{borderColor:"var(--destructive)"}:{}},placeholder:"name@institution.org",value:f.email,onChange:M=>P("email",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Phone Number"}),i.jsx("input",{type:"tel",style:rc,placeholder:"+91 98765 43210",value:f.phone,onChange:M=>P("phone",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.role,children:[i.jsx(Po,{text:"Speaker Role",required:!0}),i.jsx(J9,{children:i.jsxs("select",{style:{...Z9,...m.role?{borderColor:"var(--destructive)"}:{}},value:f.role,onChange:M=>P("role",M.target.value),onFocus:Cl,onBlur:El,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(Zo,{children:[i.jsx(Po,{text:"Profile Visibility",required:!0}),i.jsx(Uy,{name:"visibility",value:f.visibility,onChange:M=>P("visibility",M),options:[{label:"Public",value:"Public"},{label:"Private",value:"Private"}]}),i.jsx($y,{text:"Public speakers appear on the event website."})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Featured Speaker"}),i.jsx(Uy,{name:"featured",value:f.featured,onChange:M=>P("featured",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx($y,{text:"Featured speakers appear on the event homepage."})]})]})}),i.jsxs(zE,{n:2,title:"Profile & Media",subtitle:"Upload a photo, write a bio, and add social links",open:l===2,completed:u.has(2),onToggle:()=>I(2),onSave:()=>O(2),nextLabel:"Logistics",children:[i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{children:[i.jsx(Po,{text:"Profile Photo"}),i.jsx(T8e,{preview:f.photo,onChange:M=>P("photo",M),eventId:n??void 0}),i.jsx($y,{text:"JPG, PNG, WEBP or GIF · Max 2 MB · Square crop recommended · Uploaded via media API (S3 / CDN)"})]}),i.jsxs(Zo,{error:m.bio,children:[i.jsx(Po,{text:"Bio",required:!0}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...rc,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:M=>P("bio",M.target.value),onFocus:Cl,onBlur:El}),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($y,{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(FE,{icon:i.jsx(Wf,{size:14}),placeholder:"https://personal-website.com",value:f.website,onChange:M=>P("website",M)}),i.jsx(FE,{icon:i.jsx(mre,{size:14}),placeholder:"linkedin.com/in/username",value:f.linkedin,onChange:M=>P("linkedin",M)}),i.jsx(FE,{icon:i.jsx(mne,{size:14}),placeholder:"twitter.com/handle",value:f.twitter,onChange:M=>P("twitter",M)})]})]}),i.jsx(zE,{n:3,title:"Logistics",subtitle:"Manage honorarium, travel, and special requirements",open:l===3,completed:u.has(3),onToggle:()=>I(3),onSave:C,nextLabel:"Save Speaker",nextDisabled:!R,isLast:!0,children:i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{children:[i.jsx(Po,{text:"Honorarium",required:!0}),i.jsx(Uy,{name:"honorarium",value:f.honorarium,onChange:M=>P("honorarium",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),f.honorarium==="Yes"&&i.jsxs(Zo,{children:[i.jsx(Po,{text:"Amount (₹)"}),i.jsx("input",{type:"number",style:rc,placeholder:"0.00",value:f.honorariumAmount,onChange:M=>P("honorariumAmount",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Travel Required",required:!0}),i.jsx(Uy,{name:"travel",value:f.travelRequired,onChange:M=>P("travelRequired",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Accommodation",required:!0}),i.jsx(Uy,{name:"accommodation",value:f.accommodation,onChange:M=>P("accommodation",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Dietary / Special Requirements"}),i.jsx("input",{style:rc,placeholder:"e.g. Vegetarian, Gluten-free, Wheelchair access…",value:f.dietaryRequirements,onChange:M=>P("dietaryRequirements",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Internal Notes"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...rc,resize:"vertical",minHeight:"72px",paddingBottom:"22px"},placeholder:"Internal notes visible only to organisers…",value:f.notes,maxLength:300,onChange:M=>P("notes",M.target.value),onFocus:Cl,onBlur:El}),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($y,{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})})]})})]})]})]})}function R8e({onClose:e,onSuccess:t}){var C;const{user:r}=Mr(),n=Nn(r),[o,a]=S.useState(""),[s,l]=S.useState(null),[c,u]=S.useState([]),[d,f]=S.useState(new Set),[h,p]=S.useState(!1),[v,m]=S.useState(""),[b,x]=S.useState(""),[w,k]=S.useState(!1),[j,_]=S.useState(null),T=!!((C=r==null?void 0:r.organization)!=null&&C._id||r!=null&&r.organization);S.useEffect(()=>{n&&Lr.list({limit:400,organization:n}).then(I=>{var R;(R=I.data)!=null&&R.events&&u(I.data.events)})},[n]);const A=I=>{f(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},P=I=>{var F;const R=(F=I.target.files)==null?void 0:F[0];R&&(_(null),R.text().then(M=>{a(M),l(R.name)}).catch(()=>_("Could not read file.")),I.target.value="")},N=S.useCallback(async()=>{if(_(null),!T){_("Your account must belong to an organization.");return}if(!o.trim()){_("Choose a CSV file first.");return}if(h&&!v.trim()){_("Enter a list name for the custom list.");return}k(!0);const I=await ai.importGlobal({csv:o,eventIds:[...d],createCustomList:h,listName:h?v.trim():void 0,listDescription:h?b.trim():void 0});if(k(!1),I.error){_(I.error);return}const R=I.data,F=[(R==null?void 0:R.participantsCreated)!=null?`${R.participantsCreated} new participant(s)`:null,R!=null&&R.membershipsAdded?`${R.membershipsAdded} event membership(s) added`:null,R!=null&&R.profilesUpdated?`${R.profilesUpdated} profile(s) updated`:null].filter(Boolean);let M=F.length?F.join(" · "):"Import finished.";R!=null&&R.skippedDuplicate&&(M+=` · Skipped duplicate membership(s): ${R.skippedDuplicate}.`),R!=null&&R.failed&&(M+=` · Failed rows: ${R.failed}.`),h&&(R!=null&&R.listId)&&(M+=` Custom list created (${R.listRows??0} rows, ${R.listLinked??0} linked).`),t(M),e()},[o,d,h,v,b,T,e,t]),O=w||!o.trim()||!T||h&&!v.trim();return i.jsx(ra,{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:O,onCtaClick:N,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"16px"},children:[j&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:j}),!T&&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(dt,{children:[i.jsx(ht,{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(Fl,{size:16}),s||"Choose file…",i.jsx("input",{type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:P})]}),i.jsx(Vt,{text:"Required: email, first name, last name per row."})]}),i.jsxs(dt,{children:[i.jsx(ht,{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(I=>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(I._id),onChange:()=>A(I._id)}),i.jsx("span",{children:I.name})]},I._id))}),i.jsx(Vt,{text:"Selected events get a pending membership for each imported person. Leave empty to only add/update people in your org pool."})]}),i.jsx(dt,{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:I=>p(I.target.checked)}),"Also create a custom list from this import"]})}),h&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"List name",required:!0}),i.jsx("input",{style:Ht,value:v,onChange:I=>m(I.target.value),onFocus:St,onBlur:jt,placeholder:"e.g. January invitees"})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},value:b,onChange:I=>x(I.target.value),onFocus:St,onBlur:jt,placeholder:"Optional notes for admins"})]})]})]})})}function L8e(e){return e.split(/[,;\n]+/).map(t=>t.trim()).filter(Boolean)}function F8e({participantId:e,onClose:t,onSaved:r}){const[n,o]=S.useState(""),[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(""),[k,j]=S.useState(!0),[_,T]=S.useState(!1),[A,P]=S.useState(null);S.useEffect(()=>{j(!0),P(null),ai.get(e).then(O=>{if(j(!1),O.error||!O.data){P(O.error||"Could not load participant");return}const C=O.data;o(C.email??""),s(C.firstName??""),c(C.lastName??""),d(C.phone??""),h(C.organization??""),v(C.designation??""),b(C.notes??"");const I=C.tags;w(Array.isArray(I)?I.join(", "):"")}).catch(()=>{j(!1),P("Could not load participant")})},[e]);const N=S.useCallback(async()=>{if(P(null),!n.trim()){P("Email is required");return}T(!0);const O=L8e(x),C=await ai.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:O});if(T(!1),C.error){P(C.error);return}r(),t()},[e,n,a,l,u,f,p,m,x,t,r]);return i.jsx(ra,{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:N,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[A&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:A}),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(dt,{children:[i.jsx(ht,{text:"Email",required:!0}),i.jsx("input",{style:Ht,value:n,onChange:O=>o(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"First name",required:!0}),i.jsx("input",{style:Ht,value:a,onChange:O=>s(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Last name",required:!0}),i.jsx("input",{style:Ht,value:l,onChange:O=>c(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Phone"}),i.jsx("input",{style:Ht,value:u,onChange:O=>d(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Organization"}),i.jsx("input",{style:Ht,value:f,onChange:O=>h(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Designation"}),i.jsx("input",{style:Ht,value:p,onChange:O=>v(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsx("input",{style:Ht,value:x,onChange:O=>w(O.target.value),onFocus:St,onBlur:jt,placeholder:"e.g. VIP, Speaker"}),i.jsx(Vt,{text:"Comma or semicolon separated."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Notes"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},value:m,onChange:O=>b(O.target.value),onFocus:St,onBlur:jt})]})]})]})})}function z8e(e){return e<1024?e+" B":e<1048576?(e/1024).toFixed(1)+" KB":(e/1048576).toFixed(1)+" MB"}function M8e({onClose:e,onSuccess:t}){const{user:r}=Mr(),n=Nn(r),o=3,a=wc(o),s=S.useRef(null),[l,c]=S.useState([]),[u,d]=S.useState(!1),[f,h]=S.useState({collection:"",description:"",visibility:"Private",tags:""}),[p,v]=S.useState([]),[m,b]=S.useState(""),[x,w]=S.useState({}),[k,j]=S.useState({}),[_,T]=S.useState(!1),A=(M,Y)=>{h(X=>({...X,[M]:Y})),j(X=>({...X,[M]:void 0}))};S.useEffect(()=>{if(!n){v([]),b("Organisation required to load collections.");return}r2.list({organization:n}).then(v).catch(()=>{v([]),b("Could not load collections.")})},[n]);const P=M=>{const Y=Array.from(M).map(X=>({id:Math.random().toString(36).slice(2),file:X}));c(X=>[...X,...Y]),j(X=>({...X,files:void 0}))},N=S.useCallback(M=>M===1?l.length===0?(j(Y=>({...Y,files:"Add at least one file to upload."})),!1):(j(Y=>({...Y,files:void 0})),!0):M===2?f.collection&&!p.some(X=>X._id===f.collection)?(j(X=>({...X,collection:"Select a valid collection or choose None."})),!1):(j(Y=>({...Y,collection:void 0})),!0):M===3?f.visibility!=="Private"&&f.visibility!=="Public"?(j(Y=>({...Y,visibility:"Select a visibility option."})),!1):(j(Y=>({...Y,visibility:void 0})),!0):!0,[l.length,f.collection,f.visibility,p]),O=M=>{const Y=N(M);w(X=>({...X,[M]:Y?"":"Fix the errors below before continuing."})),Y&&a.advance(M)},C=S.useCallback(()=>{const M=N(1),Y=N(2),X=N(3);return w($=>({...$,99:"",1:M?"":$[1]||"Fix the errors below before continuing.",2:Y?"":$[2]||"Fix the errors below before continuing.",3:X?"":$[3]||"Fix the errors below before continuing."})),!M||!Y||!X?(w($=>({...$,99:"Complete and fix all sections before uploading."})),!1):!0},[N]),I=M=>{c(Y=>Y.filter(X=>X.id!==M))},R=async()=>{if(!C())return;T(!0),c(V=>V.map(D=>({...D,error:void 0,uploading:!0,done:!1})));const M=f.visibility==="Public"?"public":"private",Y=f.tags.trim(),X=f.description.trim(),$=f.collection.trim()||void 0;let ee=!1;for(let V=0;Vq.map(G=>G.id===z?{...G,uploading:!1,done:!0}:G))}catch(q){ee=!0;const G=q instanceof Error?q.message:"Upload failed";c(U=>U.map(Q=>Q.id===z?{...Q,uploading:!1,done:!1,error:G}:Q))}}T(!1),ee||(t==null||t(),e())},F=()=>{R()};return i.jsxs(ra,{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:()=>O(1),nextLabel:"File Details",nextDisabled:_,sectionError:x[1],children:[i.jsx(dt,{error:k.files,children:i.jsxs("div",{onClick:()=>{var M;return(M=s.current)==null?void 0:M.click()},onDragOver:M=>{M.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:M=>{M.preventDefault(),d(!1),P(M.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:M=>M.target.files&&P(M.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(Fl,{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(M=>{const Y=M.file.type.startsWith("image")?"var(--chart-1)":M.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 ${M.error?"var(--destructive)":"var(--border)"}`},children:[i.jsx(mT,{size:18,style:{color:Y,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:M.file.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"2px 0 0"},children:z8e(M.file.size)}),M.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(Wh,{size:12})," ",M.error]})]}),M.uploading&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)"},children:"Uploading…"}),M.done&&!M.error&&i.jsx(yv,{size:14,style:{color:"#22c55e",flexShrink:0}}),i.jsx("button",{type:"button",onClick:()=>I(M.id),disabled:_,style:{background:"none",border:"none",cursor:_?"not-allowed":"pointer",color:"var(--muted)",display:"flex",flexShrink:0},children:i.jsx(Gt,{size:14})})]},M.id)})}),i.jsx(Vt,{text:"Supported: PDF, JPG, PNG, MP4, ZIP, PPTX, DOCX."})]}),i.jsxs(Ur,{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:()=>O(2),nextLabel:"Visibility",nextDisabled:_,sectionError:x[2],children:[m&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0},children:m}),i.jsxs(dt,{error:k.collection,children:[i.jsx(ht,{text:"Add to Collection"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:{...Tr,...k.collection?{borderColor:"var(--destructive)"}:{}},value:f.collection,onChange:M=>A("collection",M.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"None (Library only)"}),p.map(M=>i.jsx("option",{value:M._id,children:M.name},M._id))]})}),i.jsx(Vt,{text:"Optional. New files are appended to the collection after upload."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description / Notes"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Optional notes about these files…",value:f.description,onChange:M=>A("description",M.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsx("input",{style:Ht,placeholder:"e.g. keynote, day1, sponsor",value:f.tags,onChange:M=>A("tags",M.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Separate tags with commas."})]})]}),i.jsx(Ur,{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:F,nextLabel:"Save Files",nextDisabled:_,sectionError:x[3],children:i.jsxs(dt,{error:k.visibility,children:[i.jsx(ht,{text:"File Visibility",required:!0}),i.jsx(Hi,{name:"fileVis",value:f.visibility,onChange:M=>A("visibility",M),options:[{label:"Private (team only)",value:"Private"},{label:"Public (attendees can view)",value:"Public"}]}),i.jsx(Vt,{text:"Public files may be linked from the event website."})]})})]})}function rW(e){const t=e.type;return t==="image"?"Image":t==="pdf"?"PDF":t==="video"?"Video":"Other"}function D8e(e){return e==null||Number.isNaN(e)?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function k1(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||e.email}const nW={Image:"var(--chart-1)",PDF:"var(--destructive)",Video:"var(--chart-5)",Other:"var(--muted)"},B8e={Image:i.jsx(Gte,{size:14}),PDF:i.jsx(Sh,{size:14}),Video:i.jsx(Zte,{size:14}),Other:i.jsx(mT,{size:14})},W8e=["Media Kit","Presentations","Speaker Resources","Recordings","Marketing Assets","Attendee Resources","Other"],q8e=["📁","🗂️","📸","🎥","📄","🎤","🏆","⭐","🎨","📊","🔖","💼"],$8e=["All","Image","PDF","Video","Other"];function U8e(e){return e!=null&&e.length?e.map(t=>typeof t=="string"?t:t._id):[]}function H8e(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:U8e(e.sharedWith),passwordProtected:!!e.passwordProtected,password:"",expiryEnabled:!!e.expiryEnabled,expiryDate:n,notifyOnAdd:e.notifyOnAdd!==!1,notifyOnShare:e.notifyOnShare!==!1}}function V8e({onClose:e,onSuccess:t,editing:r=null}){const{user:n}=Mr(),o=Nn(n),a=4,s=wc(a),[l,c]=S.useState({name:"",description:"",collectionType:"",coverIcon:"📁",tags:[],selectedFiles:[],visibility:"Private",sharedWith:[],passwordProtected:!1,password:"",expiryEnabled:!1,expiryDate:"",notifyOnAdd:!0,notifyOnShare:!0}),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(""),[m,b]=S.useState({}),[x,w]=S.useState({}),[k,j]=S.useState(!1),_=(H,ie)=>{c(ke=>({...ke,[H]:ie}));const le={name:["name"],collectionType:["collectionType"],visibility:["visibility","sharedWith","password","expiryDate"],sharedWith:["sharedWith"],passwordProtected:["password"],password:["password"],expiryEnabled:["expiryDate"],expiryDate:["expiryDate"],selectedFiles:["files"]}[H];le!=null&&le.length&&w(ke=>{const ve={...ke};for(const se of le)delete ve[se];return ve})};S.useEffect(()=>{let H=!1;if(!o){d([]),v("Organisation required to load library.");return}return(async()=>{try{const{media:ie}=await h$({limit:400,organization:o});H||(d(ie),v(""))}catch{H||(d([]),v("Could not load library."))}})(),()=>{H=!0}},[o]),S.useEffect(()=>{let H=!1;return(async()=>{var le;const ie=await Sx.list();if(H)return;if(ie.error||!((le=ie.data)!=null&&le.users)){h([]);return}const de=n==null?void 0:n._id;h(de?ie.data.users.filter(ke=>ke._id!==de):ie.data.users)})(),()=>{H=!0}},[n==null?void 0:n._id]),S.useEffect(()=>{r&&(c(H8e(r)),b({}),w({}))},[r==null?void 0:r._id]);const T=S.useCallback(H=>{if(H===1){const ie={};return l.name.trim()||(ie.name="Collection name is required."),l.collectionType.trim()||(ie.collectionType="Select a collection type."),Object.keys(ie).length>0?(w(de=>({...de,...ie})),!1):(w(de=>({...de,name:void 0,collectionType:void 0})),!0)}if(H===2){if(l.selectedFiles.length<1)return w(le=>({...le,files:"Select at least one file from your library."})),!1;const ie=new Set(u.map(le=>le._id));return l.selectedFiles.every(le=>ie.has(le))?(w(le=>({...le,files:void 0})),!0):(w(le=>({...le,files:"One or more selected files are no longer available."})),!1)}if(H===3){const ie={};if(["Private","Shared","Public"].includes(l.visibility)||(ie.visibility="Select a visibility option."),l.visibility==="Shared"&&l.sharedWith.length<1&&(ie.sharedWith="Add at least one team member to share with."),l.visibility==="Public"&&l.passwordProtected&&(!r||!r.passwordProtected&&l.passwordProtected)&&!l.password.trim()&&(ie.password="Enter a password or turn off password protection."),l.visibility==="Public"&&l.expiryEnabled)if(!l.expiryDate.trim())ie.expiryDate="Choose an expiry date.";else{const de=new Date(l.expiryDate);de.setHours(23,59,59,999),de.getTime()<=Date.now()&&(ie.expiryDate="Expiry date must be in the future.")}return w(de=>({...de,...ie})),Object.keys(ie).length?!1:(w(de=>({...de,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]),A=H=>{const ie=T(H);b(de=>({...de,[H]:ie?"":"Fix the errors below before continuing."})),ie&&s.advance(H)},P=S.useCallback(()=>{const H=T(1),ie=T(2),de=T(3),le=T(4);return b(ke=>({...ke,99:"",1:H?"":ke[1]||"Fix the errors below before continuing.",2:ie?"":ke[2]||"Fix the errors below before continuing.",3:de?"":ke[3]||"Fix the errors below before continuing.",4:le?"":ke[4]||"Fix the errors below before continuing."})),!H||!ie||!de||!le?(b(ke=>({...ke,99:r?"Complete and fix all sections before saving.":"Complete and fix all sections before creating the collection."})),!1):!0},[T,r]),N=()=>{const H=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:H,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}},O=async()=>{if(!P())return;j(!0),b(ie=>({...ie,99:""}));const H=N();try{r!=null&&r._id?await r2.update(r._id,H):await r2.create(H),t==null||t(),e()}catch(ie){const de=ie instanceof Error?ie.message:r?"Could not update collection.":"Could not create collection.";b(le=>({...le,99:de}))}finally{j(!1)}},C=()=>{O()},[I,R]=S.useState(""),F=S.useRef(null),M=()=>{const H=I.trim();H&&!l.tags.includes(H)&&_("tags",[...l.tags,H]),R("")},Y=H=>_("tags",l.tags.filter(ie=>ie!==H)),X=H=>{(H.key==="Enter"||H.key===",")&&(H.preventDefault(),M()),H.key==="Backspace"&&!I&&l.tags.length&&Y(l.tags[l.tags.length-1])},[$,ee]=S.useState(""),[V,D]=S.useState("All"),z=u.filter(H=>{const ie=rW(H);return(!$||H.name.toLowerCase().includes($.toLowerCase()))&&(V==="All"||ie===V)}),q=H=>_("selectedFiles",l.selectedFiles.includes(H)?l.selectedFiles.filter(ie=>ie!==H):[...l.selectedFiles,H]),[G,U]=S.useState(""),Q=f.filter(H=>!l.sharedWith.includes(H._id)&&k1(H).toLowerCase().includes(G.toLowerCase())),K=H=>{_("sharedWith",[...l.sharedWith,H]),U("")},re=H=>_("sharedWith",l.sharedWith.filter(ie=>ie!==H));return i.jsxs(ra,{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{O()},children:[m[99]&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",padding:"0 20px",margin:0},children:m[99]}),i.jsxs(Ur,{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:()=>A(1),nextLabel:"Add Files",nextDisabled:k,sectionError:m[1],children:[i.jsxs(dt,{error:x.name,children:[i.jsx(ht,{text:"Collection Name",required:!0}),i.jsx("input",{style:{...Ht,...x.name?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. NAPCON 2026 Media Kit",value:l.name,onChange:H=>_("name",H.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"What does this collection contain? Who is it for?",value:l.description,onChange:H=>_("description",H.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{error:x.collectionType,children:[i.jsx(ht,{text:"Collection Type",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:{...Tr,...x.collectionType?{borderColor:"var(--destructive)"}:{}},value:l.collectionType,onChange:H=>_("collectionType",H.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select type…"}),W8e.map(H=>i.jsx("option",{value:H,children:H},H))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Cover Icon"}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",paddingTop:"2px"},children:q8e.map(H=>i.jsx("button",{onClick:()=>_("coverIcon",H),title:H,style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:`2px solid ${l.coverIcon===H?"var(--primary)":"var(--border)"}`,background:l.coverIcon===H?"var(--accent)":"var(--secondary)",cursor:"pointer",fontSize:"15px",display:"flex",alignItems:"center",justifyContent:"center",transition:"border-color .12s"},children:H},H))})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{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 H;return(H=F.current)==null?void 0:H.focus()},children:[l.tags.map(H=>i.jsx(u2,{text:H,onRemove:()=>Y(H)},H)),i.jsx("input",{ref:F,value:I,onChange:H=>R(H.target.value),onKeyDown:X,onBlur:M,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(Vt,{text:"Tags help attendees and admins find this collection quickly."})]})]}),i.jsxs(Ur,{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:()=>A(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(H=>{const ie=u.find(de=>de._id===H);return i.jsx(u2,{text:(ie==null?void 0:ie.name)??H,onRemove:()=>q(H)},H)})}),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:{...Ht,paddingLeft:"30px"},placeholder:"Search library…",value:$,onChange:H=>ee(H.target.value),onFocus:St,onBlur:jt})]}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:$8e.map(H=>i.jsxs("button",{onClick:()=>D(H),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"99px",border:`1px solid ${V===H?"var(--primary)":"var(--border)"}`,background:V===H?"var(--accent)":"var(--card)",color:V===H?"var(--primary)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",transition:"all .12s"},children:[H!=="All"&&i.jsx("span",{style:{color:nW[H]??"var(--muted)"},children:B8e[H]}),H]},H))}),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."}):z.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."}):z.map(H=>{const ie=rW(H),de=l.selectedFiles.includes(H._id);return i.jsxs("button",{onClick:()=>q(H._id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"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 ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all .12s"},children:de&&i.jsx(bi,{size:10,style:{color:"#fff"}})}),i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:nW[ie]??"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:H.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0},children:ie}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,minWidth:"52px",textAlign:"right"},children:D8e(H.size)})]},H._id)})}),i.jsx(dt,{error:x.files,children:i.jsx(Vt,{text:`${l.selectedFiles.length} file${l.selectedFiles.length!==1?"s":""} selected. You can add more files later.`})})]}),i.jsxs(Ur,{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:()=>A(3),nextLabel:"Notifications",nextDisabled:k,sectionError:m[3],children:[i.jsxs(dt,{error:x.visibility,children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["Private","Shared","Public"].map(H=>{const ie={Private:{icon:i.jsx(bre,{size:14}),desc:"Only you can see this collection."},Shared:{icon:i.jsx(BO,{size:14}),desc:"Specific admins or editors you invite."},Public:{icon:i.jsx(i2,{size:14}),desc:"Anyone with the link can view."}},de=l.visibility===H;return i.jsxs("button",{type:"button",onClick:()=>_("visibility",H),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:`1.5px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"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 ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"all .12s"},children:de&&i.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#fff"}})}),i.jsx("span",{style:{color:de?"var(--primary)":"var(--muted)",marginTop:"1px",flexShrink:0},children:ie[H].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:de?"var(--primary)":"var(--card-foreground)"},children:H}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:ie[H].desc})]})]},H)})})]}),l.visibility==="Shared"&&i.jsxs(dt,{error:x.sharedWith,children:[i.jsx(ht,{text:"Share With"}),l.sharedWith.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"8px"},children:l.sharedWith.map(H=>{const ie=f.find(le=>le._id===H),de=ie?k1(ie):H;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:de.split(/\s+/).filter(Boolean).map(le=>le[0]).join("").slice(0,2).toUpperCase()}),de,i.jsx("button",{type:"button",onClick:()=>re(H),style:{background:"none",border:"none",cursor:"pointer",display:"flex",padding:0,color:"var(--muted)"},children:i.jsx(Gt,{size:10})})]},H)})}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{style:Ht,placeholder:"Search team members…",value:G,onChange:H=>U(H.target.value),onFocus:St,onBlur:jt}),G&&Q.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:Q.map(H=>i.jsxs("button",{type:"button",onMouseDown:()=>K(H._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:ie=>{ie.currentTarget.style.background="var(--secondary)"},onMouseLeave:ie=>{ie.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:k1(H).split(/\s+/).filter(Boolean).map(ie=>ie[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:k1(H)}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:H.role})]})]},H._id))})]}),i.jsx(Vt,{text:"Team members will receive an email notification when added."})]}),l.visibility==="Public"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{error:x.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(W6,{value:l.passwordProtected,onChange:H=>_("passwordProtected",H)})]}),l.passwordProtected&&i.jsxs(i.Fragment,{children:[i.jsx("input",{style:{...Ht,marginTop:"8px",...x.password?{borderColor:"var(--destructive)"}:{}},type:"password",placeholder:"Set access password…",value:l.password,onChange:H=>_("password",H.target.value),onFocus:St,onBlur:jt}),(r==null?void 0:r.passwordProtected)&&i.jsx(Vt,{text:"Leave blank to keep the current password. Enter a new value to replace it."})]})]}),i.jsxs(dt,{error:x.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(W6,{value:l.expiryEnabled,onChange:H=>_("expiryEnabled",H)})]}),l.expiryEnabled&&i.jsx("input",{style:{...Ht,marginTop:"8px",...x.expiryDate?{borderColor:"var(--destructive)"}:{}},type:"date",value:l.expiryDate,onChange:H=>_("expiryDate",H.target.value),onFocus:St,onBlur:jt})]})]})]}),i.jsxs(Ur,{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:C,nextLabel:r?"Save changes":"Create Collection",nextDisabled:k,sectionError:m[4],children:[i.jsx(Nm,{text:"Notify me when…"}),i.jsx(iW,{icon:i.jsx(BO,{size:14}),label:"Files are added or removed",description:"Get notified whenever a file is uploaded or deleted.",value:l.notifyOnAdd,onChange:H=>_("notifyOnAdd",H)}),i.jsx(iW,{icon:i.jsx(i2,{size:14}),label:"Collection is shared",description:"Alert me when someone shares or accesses this collection.",value:l.notifyOnShare,onChange:H=>_("notifyOnShare",H)}),i.jsx(Vt,{text:"Notifications are sent to your account email. You can change preferences in Settings."})]})]})}function W6({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 iW({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(fT,{size:14}):i.jsx(pte,{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(W6,{value:n,onChange:o})]})}var H1={exports:{}};/*! - * Quill Editor v1.3.7 - * https://quilljs.com/ - * Copyright (c) 2014, Jason Chen - * Copyright (c) 2013, salesforce.com - */var Y8e=H1.exports,oW;function G8e(){return oW||(oW=1,(function(e,t){(function(n,o){e.exports=o()})(typeof self<"u"?self:Y8e,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),v=o(32),m=o(33),b=o(31),x=o(1),w={Scope:x.Scope,create:x.create,find:x.find,query:x.query,register:x.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:v.default,Style:m.default,Store:b.default}};n.default=w}),(function(r,n,o){var a=this&&this.__extends||(function(){var b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,w){x.__proto__=w}||function(x,w){for(var k in w)w.hasOwnProperty(k)&&(x[k]=w[k])};return function(x,w){b(x,w);function k(){this.constructor=x}x.prototype=w===null?Object.create(w):(k.prototype=w.prototype,new k)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=(function(b){a(x,b);function x(w){var k=this;return w="[Parchment] "+w,k=b.call(this,w)||this,k.message=w,k.name=k.constructor.name,k}return x})(Error);n.ParchmentError=s;var l={},c={},u={},d={};n.DATA_KEY="__blot";var f;(function(b){b[b.TYPE=3]="TYPE",b[b.LEVEL=12]="LEVEL",b[b.ATTRIBUTE=13]="ATTRIBUTE",b[b.BLOT=14]="BLOT",b[b.INLINE=7]="INLINE",b[b.BLOCK=11]="BLOCK",b[b.BLOCK_BLOT=10]="BLOCK_BLOT",b[b.INLINE_BLOT=6]="INLINE_BLOT",b[b.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",b[b.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",b[b.ANY=15]="ANY"})(f=n.Scope||(n.Scope={}));function h(b,x){var w=v(b);if(w==null)throw new s("Unable to create "+b+" blot");var k=w,j=b instanceof Node||b.nodeType===Node.TEXT_NODE?b:k.create(x);return new k(j,x)}n.create=h;function p(b,x){return x===void 0&&(x=!1),b==null?null:b[n.DATA_KEY]!=null?b[n.DATA_KEY].blot:x?p(b.parentNode,x):null}n.find=p;function v(b,x){x===void 0&&(x=f.ANY);var w;if(typeof b=="string")w=d[b]||l[b];else if(b instanceof Text||b.nodeType===Node.TEXT_NODE)w=d.text;else if(typeof b=="number")b&f.LEVEL&f.BLOCK?w=d.block:b&f.LEVEL&f.INLINE&&(w=d.inline);else if(b instanceof HTMLElement){var k=(b.getAttribute("class")||"").split(/\s+/);for(var j in k)if(w=c[k[j]],w)break;w=w||u[b.tagName]}return w==null?null:x&f.LEVEL&w.scope&&x&f.TYPE&w.scope?w:null}n.query=v;function m(){for(var b=[],x=0;x1)return b.map(function(j){return m(j)});var w=b[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(j){return j.toUpperCase()}):w.tagName=w.tagName.toUpperCase();var k=Array.isArray(w.tagName)?w.tagName:[w.tagName];k.forEach(function(j){(u[j]==null||w.className==null)&&(u[j]=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(v){var m=f(v)?h:p;m.push(v)}),[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=[],v=c.iterator(this.ops),m=0;m0&&p.next(m.retain-b)}for(var x=new d(v);h.hasNext()||p.hasNext();)if(p.peekType()==="insert")x.push(p.next());else if(h.peekType()==="delete")x.push(h.next());else{var w=Math.min(h.peekLength(),p.peekLength()),k=h.next(w),j=p.next(w);if(typeof j.retain=="number"){var _={};typeof k.retain=="number"?_.retain=w:_.insert=k.insert;var T=c.attributes.compose(k.attributes,j.attributes,typeof k.retain=="number");if(T&&(_.attributes=T),x.push(_),!p.hasNext()&&s(x.ops[x.ops.length-1],_)){var A=new d(h.rest());return x.concat(A).chop()}}else typeof j.delete=="number"&&typeof k.retain=="number"&&x.push(j)}return x.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 j=w===f?"on":"with";throw new Error("diff() called "+j+" non-document")}).join("")}),v=new d,m=a(p[0],p[1],h),b=c.iterator(this.ops),x=c.iterator(f.ops);return m.forEach(function(w){for(var k=w[1].length;k>0;){var j=0;switch(w[0]){case a.INSERT:j=Math.min(x.peekLength(),k),v.push(x.next(j));break;case a.DELETE:j=Math.min(k,b.peekLength()),b.next(j),v.delete(j);break;case a.EQUAL:j=Math.min(b.peekLength(),x.peekLength(),k);var _=b.next(j),T=x.next(j);s(_.insert,T.insert)?v.retain(j,c.attributes.diff(_.attributes,T.attributes)):v.push(T).delete(j);break}k-=j}}),v.chop()},d.prototype.eachLine=function(f,h){h=h||` -`;for(var p=c.iterator(this.ops),v=new d,m=0;p.hasNext();){if(p.peekType()!=="insert")return;var b=p.peek(),x=c.length(b)-p.peekLength(),w=typeof b.insert=="string"?b.insert.indexOf(h,x)-x:-1;if(w<0)v.push(p.next());else if(w>0)v.push(p.next(w));else{if(f(v,p.next(1).attributes||{},m)===!1)return;m+=1,v=new d}}v.length()>0&&f(v,{},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),v=c.iterator(f.ops),m=new d;p.hasNext()||v.hasNext();)if(p.peekType()==="insert"&&(h||v.peekType()!=="insert"))m.retain(c.length(p.next()));else if(v.peekType()==="insert")m.push(v.next());else{var b=Math.min(p.peekLength(),v.peekLength()),x=p.next(b),w=v.next(b);if(x.delete)continue;w.delete?m.push(w):m.retain(b,c.attributes.transform(x.attributes,w.attributes,h))}return m.chop()},d.prototype.transformPosition=function(f,h){h=!!h;for(var p=c.iterator(this.ops),v=0;p.hasNext()&&v<=f;){var m=p.peekLength(),b=p.peekType();if(p.next(),b==="delete"){f-=Math.min(m,f-v);continue}else b==="insert"&&(v"u"||o.call(p,b)},d=function(p,v){s&&v.name==="__proto__"?s(p,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):p[v.name]=v.newValue},f=function(p,v){if(v==="__proto__")if(o.call(p,v)){if(l)return l(p,v).value}else return;return p[v]};r.exports=function h(){var p,v,m,b,x,w,k=arguments[0],j=1,_=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},j=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});j<_;++j)if(p=arguments[j],p!=null)for(v in p)m=f(k,v),b=f(p,v),k!==b&&(T&&b&&(u(b)||(x=c(b)))?(x?(x=!1,w=m&&c(m)?m:[]):w=m&&u(m)?m:{},d(k,{name:v,newValue:h(T,w,b)})):typeof b<"u"&&d(k,{name:v,newValue:b}));return k}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BlockEmbed=n.bubbleFormats=void 0;var a=(function(){function C(I,R){for(var F=0;F0&&(F1&&arguments[1]!==void 0?arguments[1]:!1;if(M&&(F===0||F>=this.length()-A)){var Y=this.clone();return F===0?(this.parent.insertBefore(Y,this),this):(this.parent.insertBefore(Y,this.next),Y)}else{var X=s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"split",this).call(this,F,M);return this.cache={},X}}}]),I})(h.default.Block);N.blotName="block",N.tagName="P",N.defaultChild="break",N.allowedChildren=[b.default,h.default.Embed,w.default];function O(C){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return C==null||(typeof C.formats=="function"&&(I=(0,c.default)(I,C.formats())),C.parent==null||C.parent.blotName=="scroll"||C.parent.statics.scope!==C.statics.scope)?I:O(C.parent,I)}n.bubbleFormats=O,n.BlockEmbed=P,n.default=N}),(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(V,D){var z=[],q=!0,G=!1,U=void 0;try{for(var Q=V[Symbol.iterator](),K;!(q=(K=Q.next()).done)&&(z.push(K.value),!(D&&z.length===D));q=!0);}catch(re){G=!0,U=re}finally{try{!q&&Q.return&&Q.return()}finally{if(G)throw U}}return z}return function(V,D){if(Array.isArray(V))return V;if(Symbol.iterator in Object(V))return ee(V,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ee(V,D){for(var z=0;z2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof D!="string"){var U=D.attrName||D.blotName;typeof U=="string"?this.register("formats/"+U,D,z):Object.keys(D).forEach(function(Q){q.register(Q,D[Q],z)})}else this.imports[D]!=null&&!G&&R.warn("Overwriting "+D+" with",z),this.imports[D]=z,(D.startsWith("blots/")||D.startsWith("formats/"))&&z.blotName!=="abstract"?x.default.register(z):D.startsWith("modules")&&typeof z.register=="function"&&z.register()}}]);function ee(V){var D=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(I(this,ee),this.options=M(V,z),this.container=this.options.container,this.container==null)return R.error("Invalid Quill container",V);this.options.debug&&ee.debug(this.options.debug);var q=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=x.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(U){U===p.default.events.TEXT_CHANGE&&D.root.classList.toggle("ql-blank",D.editor.isBlank())}),this.emitter.on(p.default.events.SCROLL_UPDATE,function(U,Q){var K=D.selection.lastRange,re=K&&K.length===0?K.index:void 0;Y.call(D,function(){return D.editor.update(null,Q,re)},U)});var G=this.clipboard.convert(`
`+q+"


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